Confusing NULL on a TextBox bounded to Hyperlink Field

M

mezzanine1974

I have a form bounded to a table.On the continues form, there is an
edit box (TxtHyper) which is bounded a hyperlink type field on that
table. I want the form do something after update of TxtHyper.
If TxtHyper is NOT NULL- do something, If TxtHyper is NULL do
something else.
It is working well if TxtHyper is NOT NULL. But, when i delete the
assigned hyperlink on TxtHyper and pass the textbox by TAB (I mean,
TxtHyper is becoming NULL or empty or whatever you call), TxtHyper is
still recognized as NOT NULL !!
Do you have any idea?
 
J

J_Goddard via AccessMonster.com

Hi -

It's almost impossible to say what might be wrong without seeing your code
associated with the textbox. Please post the code, and indicate what textbox
event (e.g. After Update, maybe?) is causing the problem.

John
 
D

Dirk Goldgar

mezzanine1974 said:
I have a form bounded to a table.On the continues form, there is an

Terminology note: Your form is "bound" to the table, not "bounded". And
it's a "continuous" form, not "continues". (I know Albert Kallal frequently
refers to a "continues" form in his posts, but that's just his quirky
spelling.)
edit box (TxtHyper) which is bounded a hyperlink type field on that
table. I want the form do something after update of TxtHyper.
If TxtHyper is NOT NULL- do something, If TxtHyper is NULL do
something else.
It is working well if TxtHyper is NOT NULL. But, when i delete the
assigned hyperlink on TxtHyper and pass the textbox by TAB (I mean,
TxtHyper is becoming NULL or empty or whatever you call), TxtHyper is
still recognized as NOT NULL !!
Do you have any idea?

Your text box is probably Null, but I'm guessing you aren't testing for it
properly. You cannot test for Null using the "=" operator, as nothing is
ever equal to Null, not even Null. In VBA, use the IsNull function:

If IsNull(Me!TxtHyper) Then
' deal with Null value
Else
' it's not Null
End if

Sometimes it's convenient to check for *either* a Null value or a
zero-length string ("") and handle them both the same. In that case, you
can easily convert the Null value to a ZLS by concatenating a ZLS, and then
check the length of the result:

If Len(Me!TxtHyper & vbNullString) > 0 Then
' there's something in here
Else
' it's Null or a zero-length string
End If
 
M

mezzanine1974

Hi Dirk,

Sorry for my poor english ((

This is great! Thanks
Following code is working well. So, After Update event is working
excellent!

If Len(Me!TxtHyper & vbNullString) > 0 Then
' there's something in here
Else
' it's Null or a zero-length string
End If
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top