Change the search criteria in an access search form

I want to be able to search by date or surname or table name in a form.  How would I do this?
These are the names of the tables:  LEO, BSC, SLP, MYCP.
Who is Participating?
Scott McDaniel (Microsoft Access MVP - EE MVE )Connect With a Mentor Infotrakker SoftwareCommented:
That is correct. If you would prefer to Filter your form (i.e. show only those records which match your criteria), then use the Form's Filter property:

'/build your filter string
Me.Filter = "LEO.YourNameField='" & Me.txtSearch & "' OR BSC.YourNameField='" & Me.txtSearch & "'"

This would show all of them; the user would have to navigate through them, of course.
Scott McDaniel (Microsoft Access MVP - EE MVE )Infotrakker SoftwareCommented:
When you say "search", do you want to locate a single record on the form and move to that? Or will there possibly be multiple hits from the search?

Is your form based on all 4 tables (i.e a Query); if not, how are the 4 tables represented on the form?
Dier02Author Commented:
Form is based on a query.  I want the query to search for a surname and display the data in a form.  I also want it to state that the name was not found if the name has been removed from the table.
Get 10% Off Your First Squarespace Website

Ready to showcase your work, publish content or promote your business online? With Squarespace’s award-winning templates and 24/7 customer service, getting started is simple. Head to and use offer code ‘EXPERTS’ to get 10% off your first purchase.

Dier02Author Commented:
I also want the query to include the four tables in the search.  The table names are as above.
Scott McDaniel (Microsoft Access MVP - EE MVE )Infotrakker SoftwareCommented:
Are the four tables included in the Query? If so, then you can use code like this to locate your names:

Dim rst As DAO.Recordset
Set rst = Me.RecordsetClone

rst.FindFirst "LEO.YourNameField='" & Me.txtSearch & "' OR BSC.YourNameField='" & Me.txtSearch & "'"
If Not rst.NoMatch Then
  Me.Bookmark = rst.Bookmark
  Msgbox Me.txtSearch & " not found"
End If

You'd need to change the names of the tables/controls etc to match those in your project. Also, this would only locate the FIRST record ...
Dier02Author Commented:
What doyou mean by the first record?  Do you mean if there were more than one entry for the same person it would only show one entry and not the other if, for example there was one in BSC and one in LEO?
Dier02Author Commented:
Do you mean it would show all of the records in all four tables or do you mean it would show all records for that surname in all tables?
Dier02Author Commented:
or that date
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.