I have looked up many examples and concocted the following code which is under a command in a form.
I would like this command to print the current record in the form as a report.
However, when it prints, the report template is there..but the data is not.
What could I be doing incorrectly?
Private Sub PrintReport_Click()
On Error GoTo Err_PrintReport_Click
Dim stDocName As String
Dim strWhere As String
stDocName = "CAREPORTS"
strWhere = "[CARNumber]=" & Me![CARNumber]
DoCmd.OpenReport stDocName, , , strWhere
Exit_PrintReport_Click:
Exit Sub
Err_PrintReport_Click:
MsgBox Err.Description
Resume Exit_PrintReport_Click
End Sub
I have triple checked that both fields are named CARNumber, so that isnt the problem.
Thanks Everyone.
I would like this command to print the current record in the form as a report.
However, when it prints, the report template is there..but the data is not.
What could I be doing incorrectly?
Private Sub PrintReport_Click()
On Error GoTo Err_PrintReport_Click
Dim stDocName As String
Dim strWhere As String
stDocName = "CAREPORTS"
strWhere = "[CARNumber]=" & Me![CARNumber]
DoCmd.OpenReport stDocName, , , strWhere
Exit_PrintReport_Click:
Exit Sub
Err_PrintReport_Click:
MsgBox Err.Description
Resume Exit_PrintReport_Click
End Sub
I have triple checked that both fields are named CARNumber, so that isnt the problem.
Thanks Everyone.