Clear text boxes

jpl458

Well-known member
Local time
Today, 06:09
Joined
Mar 30, 2012
Messages
1,198
Is there a way to clear all the dat entry text boxes on a form without having to address each one?
 
No, there is no Me.ClearAllTextBoxes(), but you can make one.

You can loop through all the controls of a form with by using Me. Controls, then you can use the .ControlType to see if its a acTextBox and if so you can then clear it.
 
Code:
sub ClearAllTextBoxes()
dim ctl as control
for each ctl in controls
   if Typename(ctl) = "TextBox" then ctl.value = ""
next
end sub
 
Code:
sub ClearAllTextBoxes()
dim ctl as control
for each ctl in controls
   if Typename(ctl) = "TextBox" then ctl.value = ""
next
end sub
How about Me.Requery. That seems to work.
 

Users who are viewing this thread

Back
Top Bottom