Remove text from text field

G

Guest

Hi,

I have a form setup with an unbound text box for searching record by a
specific field. It works perfectly, when i type in the text, it searches and
locates the record i need. The only issue is the text i typed in for the
search stays after i've found the record so what i want it to do is remove
the text in the field after i've found the record. I'm guess i would have to
do an event procedure on After Update for this to work. Any help would be
appreciated. Here's my code for the search text box:

Private Sub ID_Click()
On Error GoTo Err_ID_Click


DoCmd.GoToRecord , , acNewRec

Exit_ID_Click:
Exit Sub

Err_ID_Click:
MsgBox Err.Description
Resume Exit_ID_Click
End Sub
 
G

Guest

The code you posted does not do a search, it creates a new record ready for
editing.
Although a combo box is a much better control for searching than is a text
box, you can use a text box for a search. To answer your specific question,
to clear the test box when the search is complete:

Me.MyTextBox = Null
 
G

Guest

Sorry posted the wrong code. I didn't use a combo box because the reocrds
will get pretty lengthy and i didn't want a drop down with hundreds of
records. I'll try your suggestion.

Thank you I appreciate your help!
 

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