snasui wrote:
ต้องขออภัยที่ไม่มีตัวอย่างให้ครับ

รบกวนช่วยดูโค้ดให้หน่อยค่ะ ว่าถูกต้องมั้ย
จะสร้างตาราง มาใหม่ โดย มี ฟิลด์ คือ rptnanme(text) / PrintDate(date/time) / PrintUser (txt)
แล้วใส่โค้ด นี้ ในปุ่มคำสั่งปริ้น report
Private Sub Command34_Click()
DoCmd.RunSQL "Insert Into tbReportHistory Value ('rpt_plan',Now(),'ชื่อผู้ใช้งาน');"
Dim prnCnt As Long
prnCnt = Nz(DCount(" rptName ", " tbReportHistory ", " rptName = & ' rpt_plan ' & ", Month("PrintDate") = " & Month(Now()) & ", Year("PrintDate") = " & Year(Now() ) & "))
DoCmd.OpenReport "rpt_plan", acViewNormal, , , , prnCnt
DoCmd.Close acForm, "frm_search"
End Sub
แล้วหน้า Report จะใช้ โค้ด ในการ event Report open เป็น
Private Sub Report_Open(Cancel As Integer)
On Error Resume Next
txprintcount = Me.OpenArgs
End Sub
แต่พอ กดคำสั่ง ปริ้น Report แล้ว แจ้งเตือนว่า !! wrong number of arguments or invalid property assignment !! ในหน้า ที่ใส่คำสั่งปริ้น Report
ไม่ทราบว่าผิด หรือ ติดตรงไหน รบกวนด้วยนะคะ
ขอบคุณคะ