Confusing NULL on a TextBox bounded to Hyperlink Field

  • Thread starter Thread starter mezzanine1974
  • Start date Start date
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?
 
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
 
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
 
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
 
Back
Top