S
Steve B
Afternoon,
With previous help from this group, I now understand basic form validation.
I have two Combo boxes, I have set up validation so that if one particular
option is selected from the 1st combo, the user must select an option from
the second box. If they don't and press the save button the validation pops
up, however when they press no, a second box appears stating "The DoMenuItem
action was canceled."
I have searched around and suggestion such as add "DoCmd.SetWarnings false"
in the Save button function, but it still gives me the second error.
The form has a beforeupdate validation event as this
----------------------------------------------------------------
Private Sub Form_BeforeUpdate(Cancel As Integer)
If Me!cbQueryType = "Poor Build Quality" Then
If IsNull(Me!cbPoorBuild) Then
MsgBox "Poor Build! Please enter Poor Build Reason!", vbOKOnly
Cancel = True
Me!cbPoorBuild.SetFocus
End If
End If
----------------------------------------------------------------
And the save button event is
----------------------------------------------------------------
Private Sub cmdSaveRecord_Click()
On Error GoTo Err_cmdSaveRecord_Click
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
Exit_cmdSaveRecord_Click:
Exit Sub
Err_cmdSaveRecord_Click:
MsgBox Err.Description
Resume Exit_cmdSaveRecord_Click
End Sub
----------------------------------------------------------------
I've tried putting the "DoCmd.SetWarnings false" in various places and it
always fails.
Any suggestions?
Thanks
Steve
With previous help from this group, I now understand basic form validation.
I have two Combo boxes, I have set up validation so that if one particular
option is selected from the 1st combo, the user must select an option from
the second box. If they don't and press the save button the validation pops
up, however when they press no, a second box appears stating "The DoMenuItem
action was canceled."
I have searched around and suggestion such as add "DoCmd.SetWarnings false"
in the Save button function, but it still gives me the second error.
The form has a beforeupdate validation event as this
----------------------------------------------------------------
Private Sub Form_BeforeUpdate(Cancel As Integer)
If Me!cbQueryType = "Poor Build Quality" Then
If IsNull(Me!cbPoorBuild) Then
MsgBox "Poor Build! Please enter Poor Build Reason!", vbOKOnly
Cancel = True
Me!cbPoorBuild.SetFocus
End If
End If
----------------------------------------------------------------
And the save button event is
----------------------------------------------------------------
Private Sub cmdSaveRecord_Click()
On Error GoTo Err_cmdSaveRecord_Click
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
Exit_cmdSaveRecord_Click:
Exit Sub
Err_cmdSaveRecord_Click:
MsgBox Err.Description
Resume Exit_cmdSaveRecord_Click
End Sub
----------------------------------------------------------------
I've tried putting the "DoCmd.SetWarnings false" in various places and it
always fails.
Any suggestions?
Thanks
Steve