Kysteratwork
Technical User
Hi all,
I would like to print a report upon clicking button in a form.
The code I have so far is:
But I am stuck at this point: Set MyReport = Report!RptMeetings2005, which clearly is wrong what I did.
Can you help me?
Kysteratwork
I would like to print a report upon clicking button in a form.
The code I have so far is:
Code:
Private Sub PrintReport_Click()
On Error GoTo Err_PrintReport_Click
Dim stDocName As String
Dim MyReport As Report
stDocName = "RptMeetings2005"
Set MyReport = Report!RptMeetings2005
DoCmd.SelectObject acReport, stDocName, True
DoCmd.PrintOut
DoCmd.SelectObject acReport, MyReport.Name, False
Exit_PrintReport_Click:
Exit Sub
Err_PrintReport_Click:
MsgBox Err.Description
Resume Exit_PrintReport_Click
End Sub
But I am stuck at this point: Set MyReport = Report!RptMeetings2005, which clearly is wrong what I did.
Can you help me?
Kysteratwork