I have a combobox on a Form that I check to make sure the user had selected a value before he exits the Form.
I test for ChaplainCombo = '0' and give a message that this field is required and prevent the form from closing.
But if the user deletes the entry in the ChaplainCombo, the Form closes.
So I test for empty string "" as well, but the form still closes.
Here is my code in the "Unload" event:
MsgBox "Chaplain Combo='" & ChaplainCombo & "'" If ChaplainCombo = 0 Or ChaplainCombo = "" Then ReturnValue = MyMsgBox("You are Must enter a Chaplain's name!", "Missing Chaplain's Name", _ , , FormBackColor:="#FFAAAA", WindowHeight:=2745) Cancel = True End If
I msgbox ChaplainCombo and I get an empty string.
Sami ShammaOP
@Reply 2 years ago
Kevin Robertson
@Reply 2 years ago
Also check for a Null value.
If IsNull(ChaplainCombo)
Sami ShammaOP
@Reply 2 years ago
Thank you Kevin
I am definitely getting old.
Sorry, only students may add comments.
Click here for more
information on how you can set up an account.
If you are a Visitor, go ahead and post your reply as a
new comment, and we'll move it here for you
once it's approved. Be sure to use the same name and email address.
This thread is now CLOSED. If you wish to comment, start a NEW discussion in
Combo Box.