Quantcast
Channel: dBforums – Everything on Databases, Design, Developers and Administrators
Viewing all articles
Browse latest Browse all 13329

Need help with this docmd.printout command. Need If statement for no record

$
0
0
I need to an an If statment with msgbox to handle no record selected. I have a subform that lists our current projects and a print button that prints the project based on record selected. The problem I have is if there is no record selected it prints all records.

Quote:

Private Sub cmdPrint_Click()
On Error GoTo Err_cmdPrint_Click

DoCmd.OpenReport "rptWorkOrder", , , "ProjectID = " & Me!ProjectID
DoCmd.PrintOut


Exit_cmdPrint_Click:
Exit Sub
Err_cmdPrint_Click:
MsgBox Err.Description
Resume Exit_cmdPrint_Click
End Sub

Viewing all articles
Browse latest Browse all 13329

Trending Articles