Creating a "search" in a form.

  • Thread starter Thread starter Bill
  • Start date Start date
B

Bill

I am working with access 2000. What I would like to do is
create a form that will allow me to type in a keyword and
search a text field for all occurances of that keyword and
return those records to the form for editing.

I'm not sure even where to begin on this so any info will
be helpful.

Thanks
 
[txtSearchFor] - TextBo
[cmdSearch] - CommandButto

Private Sub cmdSearch_Click(

' verify search criteria has been entered. If not, display error message and en
If IsNull([txtSearchFor]) Or [txtSearchFor]="" The
MsgBox "You forgot to enter something to search for. Please try again.
txtSearchFor.SetFocu
Exit Su
End I

' otherwise..

' declare variable
Dim strCriteria As Strin
Dim strFilter As Strin

strCriteria = [txtSearchFor
strFilter = "[Field_In_Source_Table] Like '*" & strCriteria & "*'

' filter form for records meeting criteri
DoCmd.ApplyFilter , strFilte

End Su

Hope this helps

Howard Brod


----- Bill wrote: ----


I am working with access 2000. What I would like to do is
create a form that will allow me to type in a keyword and
search a text field for all occurances of that keyword and
return those records to the form for editing

I'm not sure even where to begin on this so any info will
be helpful

Thank
 
Back
Top