No Value in a text string

  • Thread starter Thread starter DavidW
  • Start date Start date
D

DavidW

How do you refer to a value for a textbox that is linked to a table field
set to text
I am trying to run a mathematical equation to check for duplicated entries,
when the code runs and there is an entry it's fine, but when there is no
match (textbox being empty) it says that the expression I entered has no
value.
How do you refer to a textbox that is text and not numerical since the
isnull statement doesnt function on text?
 
DavidW said:
How do you refer to a value for a textbox that is linked to a table field
set to text
I am trying to run a mathematical equation to check for duplicated entries,
when the code runs and there is an entry it's fine, but when there is no
match (textbox being empty) it says that the expression I entered has no
value.
How do you refer to a textbox that is text and not numerical since the
isnull statement doesnt function on text?

Your last statement is incorrect. IsNull() does not discriminate on the
DataType of the control or field fed into it.
 
Your last statement is incorrect. IsNull() does not discriminate on the
DataType of the control or field fed into it.

why does the isnull() statement not catch the empty textbox, or is my
terminolgy wrong?
I know that it looks at the texbox and it steps through the code as if there
was text in the texbox. How do you catch an empty textbox.
 
DavidW said:
why does the isnull() statement not catch the empty textbox, or is my
terminolgy wrong?
I know that it looks at the texbox and it steps through the code as if there
was text in the texbox. How do you catch an empty textbox.

The TextBox may contain an empty string which is not the same as Null. I
use the following which catches both.

If Len(Nz([SomeControl],""))=0 Then
'the control is either a zero-length-string or Null
End If
 
Rick I tried the following and still got the same error
"you have entered an expression that has no value"

If Len(Nz([Forms]![onroaduse].Text33, "")) = 0 Then
Exit Sub
End If
Any Ideals as to what I did wrong?
 
Rick Brandt said:
Your last statement is incorrect. IsNull() does not discriminate on the
DataType of the control or field fed into it.


He thinks that IsNull() should return True for an empty string. The fact
that it doesn't, leads him to conclude that Isnull() "does not work" with
text.

TC
 
DavidW said:
Rick I tried the following and still got the same error
"you have entered an expression that has no value"

If Len(Nz([Forms]![onroaduse].Text33, "")) = 0 Then
Exit Sub
End If
Any Ideals as to what I did wrong?

Where are you running this code?

Is the form onroaduse open when the code runs?
 
Back
Top