Clear Search Fields code adding to an existing Command Button

  • Thread starter Thread starter Igor via AccessMonster.com
  • Start date Start date
I

Igor via AccessMonster.com

Hey,

Im having trouble with a very simple operation. I have form with searchfields
that populate a listbox. I have a refresh button that restarts the search.
But I also need the refresh button to clear the search fields. Ive tried all
sorts of combinations with the existing code, but nothing is sticking, any
lines I put in are completely ineffectual. Not even error lines. Can someone
suggest a couple of lines that will clear the search fields, and ONLY the
search fields upon hitting refresh? Below is the code already attached to
refresh.


Thankyou wonderful forum people.



Private Sub New_Search_Click()

DoCmd.SetWarnings False
On Error GoTo Err_New_Search_Click
DoCmd.RunSQL "UPDATE tblContactInfo SET tblContactInfo.Print_YorN = False;"
DoCmd.SetWarnings True

Me.FilterOn = False

List121.RowSource = "SELECT tblContactInfo.ContactNumber," _
& "tblContactInfo.Prefix, tblContactInfo.[First Name]," _
& "tblContactInfo.Surname, tblContactInfo.Position," _
& "tblContactInfo.[Job Title], tblContactInfo.Hospitals," _
& "tblContactInfo.[Employing Agency] FROM tblContactInfo"

List121.Requery

DoCmd.DoMenuItem acFormBar, acRecordsMenu, 5, , acMenuVer70

Exit_New_Search_Click:
Exit Sub

Err_New_Search_Click:
MsgBox Err.Description
Resume Exit_New_Search_Click

End Sub
 
If anyone could advise on this. Much appreciated :( I think it should be
simple enough, just can't get it to swing.
 
Back
Top