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

setting unbound text boxes back to empty in a search form

Status
Not open for further replies.

shaunacol

Programmer
Jan 29, 2001
226
GB
I want to know how to delete data from a bunch of unbound text boxes. I can only think to write code setting each one of them back to null but there are 15 of them so im looking for a better way. Below is more info if you need it.

I have a form with several unbound text boxes, these text boxes are referenced in a query so that whatever I enter into them will be picked up by the query. The query is then the source for a list box which displays the results. Finslly I have a search button which requeries the list box when pressed. All works well. However, when user wants to start a new search they have to manually take out any info from the unbound text boxes which they entered in previous search.
 
I have just got this working using info on this site

On Error Resume Next
Dim objControl As Control
For Each objControl In Me.Controls

With objControl
If .ControlType = acComboBox Or .ControlType = acTextBox Then
.Value = ""
End If
End With

Next objControl
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top