C
Christopher Glaeser
Consider the following code sample, and in particular, the assignment
Me.Dirty = False.
------------------------------------------
Private Sub cmdPreviewFax_Click()
On Error GoTo Err_cmdPreviewFax_Click
Dim stDocName As String
If Me.cmbPrinted = 2 Then Me.cmbPrinted = 1
If Me.Dirty Then Me.Dirty = False
stDocName = "rptFacsimile"
DoCmd.OpenReport stDocName, acPreview
Exit_cmdPreviewFax_Click:
Exit Sub
Err_cmdPreviewFax_Click:
MsgBox Err.Description
Resume Exit_cmdPreviewFax_Click
End Sub
-------------------------------------------------
Some of the fields of this form are required, and if the user did not enter
a value, then a dialog box with an error message will be generated when
"Me.Dirty = False" is executed, telling the user to enter values for these
fields. At that point, I just want to resume control back to the form.
What is the recommended technique to avoid subsequent error messages from
being generated? If I delete the MsgBox statement entirely, then other
possible error messages will not be generated. How do I generate exactly
one error message with the most relevant information?
Best,
Christopher
Me.Dirty = False.
------------------------------------------
Private Sub cmdPreviewFax_Click()
On Error GoTo Err_cmdPreviewFax_Click
Dim stDocName As String
If Me.cmbPrinted = 2 Then Me.cmbPrinted = 1
If Me.Dirty Then Me.Dirty = False
stDocName = "rptFacsimile"
DoCmd.OpenReport stDocName, acPreview
Exit_cmdPreviewFax_Click:
Exit Sub
Err_cmdPreviewFax_Click:
MsgBox Err.Description
Resume Exit_cmdPreviewFax_Click
End Sub
-------------------------------------------------
Some of the fields of this form are required, and if the user did not enter
a value, then a dialog box with an error message will be generated when
"Me.Dirty = False" is executed, telling the user to enter values for these
fields. At that point, I just want to resume control back to the form.
What is the recommended technique to avoid subsequent error messages from
being generated? If I delete the MsgBox statement entirely, then other
possible error messages will not be generated. How do I generate exactly
one error message with the most relevant information?
Best,
Christopher