Stuck on Null!

adamburton

Registered User.
Local time
Today, 18:11
Joined
Jan 24, 2003
Messages
75
Please can somebody help me with a simple question! Im trying to write a case statement which runs on the selections of a combo box. This much is fine and works ok. But I want to put in a case to return a message if the combo box is empty. I have tried to put in 'null' in the case and all sorts but I cannot get it to work. Any advice would be gratefully received.

Thanks,
Adam.
 
I usually use an If Then statement for required entries

If IsNull(Me.cboMyCombo) Then
MsgBox "Please select from the list",vbCritical, "Missing Entry"
End if
 
Two ways off the top of my head:

i) With your SELECT CASE, have all the CASE IS = ### conditions and then use the CASE ELSE at the end which will capture the Null.

ii) Before checking the combobox and executing the event.

Code:
If IsNull(cboYourCombo) Then
   MsgBox "You need to select an entry from the combobox."
Else
   Select Case bla bla bla
   ? # ? # bla bla bla # ? # ?
   End Select
End If
 
thank you

guys,

thanks very much for your advice. i tried it and it worked!!

regards,
adam.
 

Users who are viewing this thread

Back
Top Bottom