Clearing multiple txtboxes

anb001

Registered User.
Local time
Today, 21:51
Joined
Jul 5, 2004
Messages
197
I'm looking for a way of clearing several txtboxes on form, when clicking a button.

I know I can use:

Code:
txtNo1.Value = Null
txtNo2.Value = Null
txtNo3.Value = Null

etc

But I assume there's an easier way of doing it, I just don't know how.

Anyone??
 
uh, how much easier could it be???

If you have alot of them, you could create a loop that will loop thru all text boxes and set them to NULL, but your way seems as easy as any. :o
 
...or

Dim ctl As Control
For Each ctl In Screen.ActiveForm
If TypeOf ctl Is TextBox Then
With ctl
.Value = Null
End With
End If
Next ctl
 
Code:
Dim ctl As Control
For Each ctl In Me
    If ctl.ControlType = acTextBox Then
        ctl = Null
    End If
Next
Set ctl = Nothing
 

Users who are viewing this thread

Back
Top Bottom