Greetings all. I am using Access 2003 and I can not figure out how to get
the following to work in the click event of a command button.
If Me.cboEWO.Value = null Then
MsgBox "Enter an EWO"
Else
rest of code.
cboEWO is a combo used for searching. When a value is chosen by cascading
or entering in a value a command button is hit to pass the value to a stored
procedure. Upon hitting the command button I would like the user to see the
message if no value has been entered in cboEWO. I tried every variation of
the above, but my skills in Access are lacking. Thank you for any help.
You can't check for null with "= null" - you need to use the IsNull
function:
If IsNull(Me.cboEWO) Then
'dosomething
Else
'do something else
End If
If you want to go the other way, you can use:
If Not IsNull(me.cboEWO) then
'dosomething else
Else
'do something
End If
Similarly, in SQL, you would use "SELECT Field FROM Table WHERE Field Is
Null" rather than "field = Null"

Signature
hth,
SusanV
> Greetings all. I am using Access 2003 and I can not figure out how to get
> the following to work in the click event of a command button.
[quoted text clipped - 12 lines]
> of
> the above, but my skills in Access are lacking. Thank you for any help.
Greg Snidow - 31 Jan 2007 19:27 GMT
Thank you so much SusanV. I knew it would be something easy.
> You can't check for null with "= null" - you need to use the IsNull
> function:
[quoted text clipped - 32 lines]
> > of
> > the above, but my skills in Access are lacking. Thank you for any help.
SusanV - 31 Jan 2007 19:37 GMT
Glad to help any time!
;-D
> Thank you so much SusanV. I knew it would be something easy.
>
[quoted text clipped - 39 lines]
>> > the above, but my skills in Access are lacking. Thank you for any
>> > help.