Null

JonyBravo

Registered User.
Local time
Today, 10:14
Joined
Jan 17, 2006
Messages
89
Hy guys!

I would like to know if is any way to inverse the following code:
This:
if isnull (txt1) then 'recognise if the box is empty
to something like this:
if isNotNull (txt1) then 'recognise if the box is not empty

Thanks
 
So you have a text box or combo box or what ever.
Lets say its a text box called txtFullOfText, ok.

If you want to test if its null or not.
Code:
If IsNull(Me.txtFullOfText) Then
If you want to test if it has data
Code:
If Not IsNull(Me.txtFullOfText) Then

Hope this helps ;)
 
Hi!

This is exactly what I want, but I would like you to explain me something.
What is the difference of using:
Me.txtFullOfText or just txtFullOfText when the final result is the same.

Thanks to help

JonyBravo
 
Me refers the current form or report the code module is inside.

While you can implicitly refer to forms, you shouldn't leave it up to computers to make assumptions. Best to explicitly refer whenever you can.

Another benefit is it makes it portable. If you take out a event and drop it into other form or whatever, it'll still work because Me will change to reflect the current module automatically.
 
Banana is absolutely right. I'll add this:

Using ctlXYZ makes a "scope" assumption.

Using me!ctlXYZ makes no such assumption.

ctlXYZ COULD have been something you created via a "DIM" statement (in a global module, perhaps) just to be perverse, or because it is a variable of type "control" that you use as an index when doing a For all ctlXYZ in {collection of controls} DO ...

Me!ctlXYZ cannot be interpreted as anything other than a control in the current form.
 

Users who are viewing this thread

Back
Top Bottom