Validation Rule...Kind Of

dsellers1

Registered User.
Local time
Yesterday, 22:48
Joined
May 19, 2009
Messages
39
I have a bound combo box that has the numbers 0 through 9 as the options. These numbers are pulled from a table and are associated with other fields (though this is not important). What I am trying to get done is have a pop up box indicating "Are you sure?" if the number 6, 7, 8, or 9 is chosen. Then, once you click ok, you can go on to finish entering data into the form

I originally thought this would fall under the validation rule in my form but now lean more towards VB. My guess is that it needs to be in the After Update event, but I can't figure out the "If" statement I should use. Any suggestions would be greatly appreciated!
 
I suspect you want the before update event, rather than the after, as the before event can be canceled. This demonstrates using the form's before update event, but you can also use the combo's if you want:

http://www.baldyweb.com/BeforeUpdate.htm
 
Pbaldy,
That link helped me more than you could imagine. I was simply missing a few words in my script. I ended up using the After Update event and it all seems to work well.

And though I feel like an idiot for missing this, I am posting the results for anyone that reads this and is interested...

Original script

Private Sub ComboBox1_AfterUpdate()
If Me.ComboBox1 >= 6
Msg "Type your message here"
End If
End Sub

Script that worked

Private Sub ComboBox1_AfterUpdate()
If Me.ComboBox1 >= 6 Then
MsgBox "Type your message here"
End If
End Sub
 
I'm glad it helped you. You realize that you can't stop the after update event? You originally said you wanted to ask "are you sure". If you want to cancel the update if they say no, you want the before update event. If you just want to throw up an advisory message box, the after update event is fine.
 
Yup. I originally wanted this to be an advisory message but you may be right. With the question in the message box, it would be best to go with the before update as opposed to after update. Thanks again!
 

Users who are viewing this thread

Back
Top Bottom