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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Access basic 97

Status
Not open for further replies.

Alastor

MIS
Aug 27, 1998
36
US
I have a form with several text boxes on it. Is there any way to clear all of the text boxes at once without individually setting their .text = ""?
 
Here is a Brute force approach with no error trapping,<br>
<br>
<br>
Sub ClearForm()<br>
Dim frm As Form, ctl As Control<br>
<br>
' Set the current form as the target<br>
Set frm = Screen.ActiveForm<br>
' Enumerate Controls collection of each form.<br>
For Each ctl In frm.Controls<br>
' Print name of each control.<br>
If ctl.ControlType = acTextBox Then<br>
ctl = ""<br>
End If<br>
Next ctl<br>
End Sub<br>

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top