By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,099 Members | 1,364 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,099 IT Pros & Developers. It's quick & easy.

Microsoft Access Problem - Stopping Macro if After Update Fails

P: 5
Hi,
This problem has been bugging me for a while. In my form's before update field i have the following code:

Private Sub Form_BeforeUpdate(Cancel As Integer)

If Me.Nominator_name = "" Or IsNull(Me.Nominator_name) Then
MsgBox "Please fill in your name", vbCritical + vbOKOnly + vbDefaultButton2, "MISSING DATA"
Me.Nominator_name.SetFocus
DoCmd.CancelEvent
Exit Sub
End If

If Me.Nominee_name = "" Or IsNull(Me.Nominee_name) Then
MsgBox "Please choose an award nominee", vbCritical + vbOKOnly + vbDefaultButton2, "MISSING DATA"
Me.Nominee_name.SetFocus
DoCmd.CancelEvent
Exit Sub
End If

If Me.List30 = "" Or IsNull(Me.List30) Then
MsgBox "Please choose an award category", vbCritical + vbOKOnly + vbDefaultButton2, "MISSING DATA"
Me.List30.SetFocus
DoCmd.CancelEvent
Exit Sub
End If

End Sub

I also have a macro running on my command button which closes the current form and opens another. When i press the command button and the form has a null field the macro still runs and produces an error message.
How do i get the macro to stop running if the verification fails????!!!!?????
Apr 4 '07 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.