I am trying to print one record displayed in a form. I also need to print one record in another form at different times. I have one form working fine. It prints out the displayed record in my report just fine by clicking the Print_report button.
I copied the report and renamed it. in this form the print button is named Print_Requested. When I open this form and click the Print_Requested button, it prints out everything except for the data.
Edit:
The reason I made a duplicate report is because it was doing the same thing when I tried to print the same report from different forms. One report is all I need, but I need to be able to print it from different forms.
Here is my code:
-----------------------------
Private Sub Print_report_Click()
On Error GoTo Err_Print_report_Click
Dim stDocName As String
stDocName = "work_order_report"
DoCmd.OpenReport "work_order_report", , , "WOnumber = " & Me.WOnumber
Exit_Print_report_Click:
Exit Sub
Err_Print_report_Click:
MsgBox Err.Description
Resume Exit_Print_report_Click
End Sub
-----------------------------
Private Sub Print_Requested_Click()
On Error GoTo Err_Print_Requested_Click
Dim stDocName As String
stDocName = "work_order_report_requested"
DoCmd.OpenReport "work_order_report_requested", , , "WOnumber = " & Me.WOnumber
Exit_Print_Requested_Click:
Exit Sub
Err_Print_Requested_Click:
MsgBox Err.Description
Resume Exit_Print_Requested_Click
End Sub
----------------------------------
Any idea what I am doing wrong??
I copied the report and renamed it. in this form the print button is named Print_Requested. When I open this form and click the Print_Requested button, it prints out everything except for the data.
Edit:
The reason I made a duplicate report is because it was doing the same thing when I tried to print the same report from different forms. One report is all I need, but I need to be able to print it from different forms.
Here is my code:
-----------------------------
Private Sub Print_report_Click()
On Error GoTo Err_Print_report_Click
Dim stDocName As String
stDocName = "work_order_report"
DoCmd.OpenReport "work_order_report", , , "WOnumber = " & Me.WOnumber
Exit_Print_report_Click:
Exit Sub
Err_Print_report_Click:
MsgBox Err.Description
Resume Exit_Print_report_Click
End Sub
-----------------------------
Private Sub Print_Requested_Click()
On Error GoTo Err_Print_Requested_Click
Dim stDocName As String
stDocName = "work_order_report_requested"
DoCmd.OpenReport "work_order_report_requested", , , "WOnumber = " & Me.WOnumber
Exit_Print_Requested_Click:
Exit Sub
Err_Print_Requested_Click:
MsgBox Err.Description
Resume Exit_Print_Requested_Click
End Sub
----------------------------------
Any idea what I am doing wrong??
Last edited: