This is a simple form. Choose Mr. Mrs. or Dr. from combo box
then enter name in TEXT box and finally gender M/F? also combo box.The code checks that Male only works for Mr. and Female for Mrs. Dr. can be either, like so...
Mr. SMITH Male
Mrs. Brown Female
Dr. Jones Female (or male as the case may be)
HERE is the question. The gender box is mandatory WHEN there is a name. if you try to leave it blank, on LOSTFOCUS then you get an error that says you must choose male or female. I want the focus to then return to the gender combobox and just keep looping this until either a M or F is specified, or the name field is cleared. I have tried this and get as far as the error message, but then focus always moves to the next control. Any suggestions?
Here is what I tried to use:
then enter name in TEXT box and finally gender M/F? also combo box.The code checks that Male only works for Mr. and Female for Mrs. Dr. can be either, like so...
Mr. SMITH Male
Mrs. Brown Female
Dr. Jones Female (or male as the case may be)
HERE is the question. The gender box is mandatory WHEN there is a name. if you try to leave it blank, on LOSTFOCUS then you get an error that says you must choose male or female. I want the focus to then return to the gender combobox and just keep looping this until either a M or F is specified, or the name field is cleared. I have tried this and get as far as the error message, but then focus always moves to the next control. Any suggestions?
Here is what I tried to use:
Code:
If IsNull(Me!cmbSex.Value) Then
MsgBox "You must specify the gender of this guest.", vbOKOnly, "Incomplete entry"
Me!cmbSex.SetFocus