vangogh228
Registered User.
- Local time
- Today, 12:49
- Joined
- Apr 19, 2002
- Messages
- 302
Hello. I am trying to write the code for a form button that will print the current record's report. I can get it to work if I use a query that asks for the issue number, but I would like to get it to do it directly from the button. The code below tries to open the report, but I really want to print from the button.
My report is called "Issues Data Report"
My form is called "Main Form"
The form field with the criterion is "Issue"
This is what I have so far:
Private Sub PrintIssueButton_Click()
On Error GoTo Err_PrintIssueButton_Click
Dim stDocName As String
stDocName = "Issues Data Report"
DoCmd.OpenReport stDocName, acNormal
Exit_PrintIssueButton_Click:
Exit Sub
Err_PrintIssueButton_Click:
MsgBox Err.Description
Resume Exit_PrintIssueButton_Click
End Sub
I appreciate your help. I know this is an easy one. I tried following the instructions from the Microsoft website 209560, but couldn't get the syntax right for some reason. I also did a search on these forums, but I am obviously missing something. THANKS!
Tom
My report is called "Issues Data Report"
My form is called "Main Form"
The form field with the criterion is "Issue"
This is what I have so far:
Private Sub PrintIssueButton_Click()
On Error GoTo Err_PrintIssueButton_Click
Dim stDocName As String
stDocName = "Issues Data Report"
DoCmd.OpenReport stDocName, acNormal
Exit_PrintIssueButton_Click:
Exit Sub
Err_PrintIssueButton_Click:
MsgBox Err.Description
Resume Exit_PrintIssueButton_Click
End Sub
I appreciate your help. I know this is an easy one. I tried following the instructions from the Microsoft website 209560, but couldn't get the syntax right for some reason. I also did a search on these forums, but I am obviously missing something. THANKS!
Tom