Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

help with value of a control 1

Status
Not open for further replies.

ProgramError

Programmer
Mar 2, 2005
1,027
GB
Dim ctrl As Control
For Each ctrl In Me.Form
If ctrl.ControlType = acTextBox Then
If [purple]ctrl.value[/purple] = Null Then Debug.Print "NULL NULL NULL"
end if
next

Help wanted to check the value of the control for null. Need syntax for purple words above.

Thanks

Ian Mayor (UK)
Program Error
Always make your words sweet and nice. Because you never know when you may have to eat them.
 
if control is null

or

nz(control, "alternateValue")

--------------------
Procrastinate Now!
 
For Each ctrl In Me.Controls
If ctrl.ControlType = acTextBox Then
If IsNull(ctrl.Value) Then
Debug.Print ctrl.Name, " NULL NULL NULL"
End If
End If
Next

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Code:
    Dim ctrl As Control
    For Each ctrl In Me.Form
        If ctrl.ControlType = acTextBox Then
           [b] If IsNull(ctrl)[/b] Then Debug.Print "NULL NULL NULL"
        End If
    Next

________________________________________________________
Zameer Abdulla
Help to find Missing people
 
FOUND IT!!!

It was ...
If IsNull(ctrl) Then Debug.Print "NULL NULL NULL"

Ian Mayor (UK)
Program Error
Always make your words sweet and nice. Because you never know when you may have to eat them.
 
Hi ZmrAbdulla

I Must have been entering my reply while you where posting yours. Have a star for the right answer anyway.

Ian Mayor (UK)
Program Error
Always make your words sweet and nice. Because you never know when you may have to eat them.
 
Ian, why are you implicitly saying that my answer wasn't right ?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top