Pat,
I did something wrong. In form design, with selection type "form", I selected the "Before Update" on the Event tab. In the build box, I selected code and entered the following: (Actually, there are 9 questions total. Just giving the "flavor".) When it didn't work, I entered the same code for "On Error" with the same results. (Results below the code in note.)
Private Sub Form_BeforeUpdate(Cancel As Integer)
'Go through each of the required fields and prompt
If [DocName] & "" = "" Then
MsgBox "Document Name is required.", vbOKOnly
DocName.SetFocus
Cancel = True
Exit Sub
If [ReviewerNameFirst] & "" = "" Then
MsgBox "Your First Name is required.", vbOKOnly
ReviewerNameFirst.SetFocus
Cancel = True
Exit Sub
If [ReviewerNameLast] & "" = "" Then
MsgBox "Your Last Name is required.", vbOKOnly
ReviewerNameLast.SetFocus
Cancel = True
Exit Sub
If [BUCRAEM01-A] & "" = "" Then
MsgBox "Rating each question is required.", vbOKOnly
[BUCRAEM01-A].SetFocus
Cancel = True
Exit Sub
End If
End Sub
This still returns the Access generated error messages. Here is the scenerio:
In the format of the form, I set the property "Close Button" to "No". In order to close, there is a Command Button that runs the [Embedded Macro] "CloseWindow".
When the user clicks this button and a required field is not populated, the error is: "You must enter a valid value in the [field name] field". Button options: "OK" or "Help".
Dialog box when click OK is:
"You can't save this record at this time.
[Application Name] may have encountered an error while trying to save a record. If you close this object now, the data changes you made will be lost.
Do you want to close the database object anyway?" Button options: "Yes" or "No".
Most of the time, the user will want to go back to the form and fill in the missing information. (The "No" option.) MS Access handling of this error is not "user friendly".
The Macro Single Step message box has the following properties/ fields:
Macro Name: My.macro.name
Action Name: CloseWindow
Arguments: , , Prompt
Buttons in upper right:
"Step" (grayed out)
"Stop All Macros" (available)
"Continue" (grayed out)
Error Number: 3021