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 |