Testing for Null value in Txtbox

P

PMC1

Hi,

Quick query!

I have a form with txtbox "txtCoName". The code behind a command button
on this form has an if..then as follows:

If me.txtcoName.Value = Null then
Do stuff
Else
Do Some other stuff
End if

The problem is when this txtbox is blank the first part of the if
statement incorrectly proves false. I can see this by placing a
breakpoint at this statement and using intelliprompt I can see the
value of the txtbox is Null but the code below is ignored and the
"else" part of the statement is evaluated. How is this possible?


Thanks
 
F

fredg

Hi,

Quick query!

I have a form with txtbox "txtCoName". The code behind a command button
on this form has an if..then as follows:

If me.txtcoName.Value = Null then
Do stuff
Else
Do Some other stuff
End if

The problem is when this txtbox is blank the first part of the if
statement incorrectly proves false. I can see this by placing a
breakpoint at this statement and using intelliprompt I can see the
value of the txtbox is Null but the code below is ignored and the
"else" part of the statement is evaluated. How is this possible?

Thanks

If IsNull(me.txtcoName.Value) then
etc....

And ... since Value is the default property you can omit it:
If IsNull(me.txtcoName) then
 
Top