Within a form I give the user the ability to print a “cleaned up” copy of the record, however, if they press the put, and then choose not to complete the operation, then I want them to be able to cancel out of the sub. I should add that if the user choose OK, then all of the printing activity is completed for the particular record without the actual “clean verison of the form” opening up (to the users eyes). Basically they get the message box, press OK, the record prints and everything is completed. However, when I select CANCEL, using the code set below, the record still prints off. It’s as if the CANCEL button action is not recognized. I am trying to use more of the MsgBox, vb actions versus always creating little custom dialog forms. Thanks for the help.
DoCmd.Echo False, “”
MsgBox “Do You wish to Print a PaySheet for this Training?”, vbOKCancel
If MsgBox(vbOKCancel) = vbCancel Then
Exit Sub
Else
DoCmd.OpenForm “frmPaySheet”, acNormal, “”, “”, , acNormal
DoCmd.GoToControl “Record#”
DoCmd.FindRecord [Record#], acEntire, False, , True, , True
DoCmd.RunCommand acCmdSelectRecord
DoCmd.PrintOut acSelection, 1, 1, acHigh, 1
DoCmd.Close acForm, “frmPaySheet”
DoCmd.Echo True, “”
End If
End Sub