var sidebar_align = 'right';
var content_container_margin = parseInt('290px');
var sidebar_width = parseInt('270px');
Unanswered: Close Form IF combo box contains value
I have a combo box on a form which has a blank default value.
I want to force the user to choose either Yes or No from the combo box before he / she closes the form.
Is there any way of putting a command on the close action of the form to check for a value in the combo box before closing, if no value then do nothing ??
Thanks for your help
Use the Unload event instead:
Private Sub Form_Unload(Cancel As Integer)
If IsNull(Me.MyCombo) then
Cancel = True 'prevents form close
That's exactly what i needed thanks.
Is there a way of popping up an error message as a reminder to fill it in if they haven't ?
Well sure, just add an appropriate MsgBox to the code with the message to the user.
Here is a little code if you need it.
Dim Response As Variant
Response = MsgBox("YOUR MESSAGE", vbOKCancel, "Message Box Name")
If Response = vbOK Then 'If OK selected do something
Hope this helps
thats brilliant guys, thanks for your help.