Hi,
I'm still pretty new to Access. Using 2007. I need to print 3 different reports. My form has 3 print report buttons. When I click each button, it allows me to print all records in the table. I only want to print the current record. I was able to find the following code that allows me to print the first report properly (only the current record).
Private Sub Command101_Click()
On Error GoTo ErrHandler
DoCmd.OpenReport ReportName:="BoL", View:=acViewPreview, _
WhereCondition:="ID=" & Me.ID
Exit Sub
ErrHandler:
' Don't show error message if report was canceled
If Err <> 2501 Then
MsgBox Err.Description, vbCritical
End If
End Sub
Where "BoL" is the name of the 1st report I need printed.
However when I tried using the same code on the other 2 buttons, it doesn't work and prompts me to enter the parameter value (ID). I guess I can only use the code once?
Also thought about using a single button for all 3 reports, but not all records need all 3 reports. Some need 1 or 2. So a button for each is ideal.
Any help would be REALLY appreciated here... thanks in advance...