Find Record

  • Thread starter Thread starter Ellen
  • Start date Start date
E

Ellen

I have a database set up and a form and a command button
to find a record. Is there a way to edit the search box to
default to "Any part of the field" in the Match selection
box? Thanks, Ellen
 
Pavel,

Thanks for the reply but I don't see anything with and "="
sign. Here is the code for the command button:

Private Sub Find_Click()
On Error GoTo Err_Find_Click


Screen.PreviousControl.SetFocus
DoCmd.DoMenuItem acFormBar, acEditMenu, 10, ,
acMenuVer70

Exit_Find_Click:
Exit Sub

Err_Find_Click:
MsgBox Err.Description
Resume Exit_Find_Click

End Sub


Thanks again for your help. Ellen
 
-----Original Message-----
I have a database set up and a form and a command button
to find a record. Is there a way to edit the search box to
default to "Any part of the field" in the Match selection
box? Thanks, Ellen
.

Ellen,

I don't know how to change it on-the-fly for a specific
search, but you can change the default search method for
Access globally through Tools, Options. Select the
Edit/Find tab, and select General Search for the default
Find/Replace Behavior. It won't take effect until the
next time you load Access.

HTH
Kevin Sprinkel
 
You can't change the setting of the built-in search form unless you change
the default setting for all of Access. However, if someone else has a
different setting on their copy of Access, they will see what ever their
setting are. The only way would be to create your own search form.

Kelvin
 
You could try to replace the entire wizard-generated DoCmd code with

Me.Form.RecordsetClone.FindFirst "Searchfield LIKE *'" &
Me.txtStringToLookFor & "*'"
IF Me.Form.RecordsetClone.NoMatch then
msgbox "No match, sorry"
else
me.Form.Recordset.Bookmark = Me.Form.RecordsetClone.Bookmark
endif

SearchField is the name of the field you search, and txtStringToLookFor
is the name of the text box you enter criteria into.
If you do not have the text field for the search criteria, you could get
it using InputBox("What to look for?"), or add the text box to the form.
Good luck,
Pavel
 
Back
Top