String Problem

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

DavidW

I tried
If Len(Nz([Forms]![onroaduse].Text33, "")) = 0 Then
beep
End If
to find out if a textbox was empty or not and still having problems.
I get the error
"The Expression you've enter does not contain a value"
Text33 default value is getting its information from
[Forms]![onroaduse].trblesubform!unit
I tried to use the textbox"unit" in the subform and had the same problem
"unit" has a control source of a query that looks at a field in a table and
distingiushes if there is data with a certain date.
I also tried in the Text33 for the default value =nz(
[Forms]![onroaduse].trblesubform!unit, 0) and when I ran the code I got
script out of range
How do you resolve the issue of a expression that has no value?
 
David

If there's nothing in the textbox, you want to do something.

Have you tried

If Nz(Forms!FormName!textboxName,"")="" then
....

Good luck

Jeff Boyce
<Access MVP>
 
Yes I have tried that and I still get the error
"You have entered an expression that has no value!"
'checks for empy Textbox
If Nz([Forms]![onroaduse].Text33, "") = "" Then
[Forms]![onroaduse].on2!Text58.Visible = False
[Forms]![onroaduse].on2!Text60.Visible = False
'ends sub if textbox is empty
Exit Sub
End If
'find a duplicated record
If [Forms]![onroaduse].Text33 = [Forms]!onroaduse].Unit Then
DoCmd.Close acForm, ("reminder")
DoCmd.OpenForm ("verror")
End If
End Sub

[Forms]![onroaduse].Text33 has the default value from a second subform(2nd
subform is linked by unit/vehicle, and by date to the main form) that
references a query to search for existing records. The first subform is for
data entry only.
 
Back
Top