davidboutche
07-31-2009, 09:14 AM
I'm trying to get vba to run a procedure as soon as the contents of a field has been entered, the DOB field. It will run a small 'if' procedure to calculate someone's age to years and then if they're under 18 give a message.
i've tried:
Private Sub DOBBOX_Change()
If CalcAge(DOBBOX.Text) < 18 _
And UserForm1.Combo_Box_01 = "Simple Caution" Then
MsgBox ("You can't issue a simple caution to an under 18")
End If
End Sub
It essentially works every time a character is entered not when it is complete.
I've seen on another forum someone use '_exit' but this gives me an error message.
How should it be correctly used if this is the correct command?
David:dunno
i've tried:
Private Sub DOBBOX_Change()
If CalcAge(DOBBOX.Text) < 18 _
And UserForm1.Combo_Box_01 = "Simple Caution" Then
MsgBox ("You can't issue a simple caution to an under 18")
End If
End Sub
It essentially works every time a character is entered not when it is complete.
I've seen on another forum someone use '_exit' but this gives me an error message.
How should it be correctly used if this is the correct command?
David:dunno