enduserextra
Technical User
I'd like to add a button to a form that will print preview a report that shows all the records for the current record ID only. Is there a way to do this? The ID is in tableA and the corresponding information is in tableB.
I created a macro and it prompts to enter the ID number you want to view the information for in the report. I don't want it to prompt, just show the report by pulling the ID from the current record that is displayed in the form.
Here's the code:
Private Sub CommandButton_Click()
On Error GoTo Err_CommandButton_Click
Dim stDocName As String
stDocName = "tableA"
DoCmd.OpenReport stDocName, acPreview
Exit_CommandButton_Click:
Exit Sub
Thanks!
I created a macro and it prompts to enter the ID number you want to view the information for in the report. I don't want it to prompt, just show the report by pulling the ID from the current record that is displayed in the form.
Here's the code:
Private Sub CommandButton_Click()
On Error GoTo Err_CommandButton_Click
Dim stDocName As String
stDocName = "tableA"
DoCmd.OpenReport stDocName, acPreview
Exit_CommandButton_Click:
Exit Sub
Thanks!