select combo box first

O

ooxx

Hi, every

How can I have the form to know and to remind a message when on click
the command button to select the combo box first before doing anything in the
code?

Thanks,
 
O

Ofer Cohen

Use the OnClick event of the button to check if a value was selected in the
combo, if not prompt a message and exit the code.

Something like

If IsNull(Me.[ComboName]) Then
MsgBox "Must select a value in Combo"
Me.[ComboName].SetFocus ' set the focus to the combo
Exit Sub ' Exit the code
End If
' Put your code here
 
O

ooxx

Thank a lot.


Ofer Cohen said:
Use the OnClick event of the button to check if a value was selected in the
combo, if not prompt a message and exit the code.

Something like

If IsNull(Me.[ComboName]) Then
MsgBox "Must select a value in Combo"
Me.[ComboName].SetFocus ' set the focus to the combo
Exit Sub ' Exit the code
End If
' Put your code here


--
Good Luck
BS"D


ooxx said:
Hi, every

How can I have the form to know and to remind a message when on click
the command button to select the combo box first before doing anything in the
code?

Thanks,
 
Top