simple question about preforming a search

  • Thread starter jjsaw5 via AccessMonster.com
  • Start date
J

jjsaw5 via AccessMonster.com

Hello,

I have a form that is used for searching my database. In the header of the
form i have a text box where the user inputs the search criteria and then
presses a "Search" button to execute it.

What i would like to do is after the search button is clicked is there a way
that i can have the text box cleared of the information that was just
searched for?


Here is the code I'm using to preform my search



Private Sub Command35_Click()
If IsNull(cmbLock) = False Then
Me.Recordset.FindFirst "[SR Num]=" & cmbLock
End If
End Sub
 
D

Douglas J. Steele

Try

Private Sub Command35_Click()
If IsNull(cmbLock) = False Then
Me.Recordset.FindFirst "[SR Num]=" & Me!cmbLock
Me!cmbLock = Null
End If
End Sub
 
J

jjsaw5 via AccessMonster.com

I tried it and it only works if you click the search button twice.
 
D

Douglas J. Steele

It shouldn't.

Try

Private Sub Command35_Click()
If IsNull(cmbLock) = False Then
Me.Recordset.FindFirst "[SR Num]=" & Me!cmbLock
Me!cmbLock = Null
DoEvents
End If
End Sub
 
J

jjsaw5 via AccessMonster.com

Its still doing the same thing you have to click it twice for it to clear the
box
 
G

Guest

are you sure you have your controls event set correctly? there are two click
event options. one is "on click" the other one is "on double click".
 
J

jjsaw5 via AccessMonster.com

Yes, i have it on the "on click" event. It exectues the search fine but it
does not clear the text box. The data stays in the box until you press the
"search" button again.
 

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