How can you reset unbound text boxes on a form?

G

Guest

I have a form with 9 unbound text boxes on it. A query links to each of these
text boxes on the form. So, if you want to search for job number 110, you
then enter 110 into the relevant text box, click my search button and a form
will return the relevant results.

However, I need to know how i can reset the text boxes on my form to be null
if a user wants to do a new search.

I don't really have any experience of VB but any help really would be
appreciated.

Thanks.
 
D

Douglas J. Steele

Simply set them to Null:

Me.Text0 = Null
Me.Text1 = Null

etc.

If these are the only text boxes on the form, you can use:

Dim ctlCurr As Control

For Each ctlCurr In Me.Controls
If ctlCurr.ControlType = acTextbox
ctlCurr = Null
End If
Next ctlCurr
 
G

Guest

Put another command button on your form with the caption CLEAR.

In the Click event of the properties dialog for the button, select On Click.
click the small button with the 3 dots and select code builder. Then for
each text box, enter a line of code like this, using the name of the text box
you want to clear:

Me.Text0 = Null
Me.Text1 = Null
etc.

Substitue the name of each text box for Text0, etc.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top