Searching across three fields

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

How do I search across three fields for a name that can occur in any
recordset? I have created a query that shows the data in 300 records I wish
to search. The fields I wish to match instances of the names are:

[GeneralManager], [Cashier1] and [Cashier2].

I would like to type in a name and locate the match for any of the three
fields.

Graeme.
 
Your WHERE clause would need to be something like:

WHERE [GeneralManager] = [Name To Match]
OR [Cashier1] = [Name To Match]
OR [Cashier2] = [Name To Match]

If you'd like to be able to type in part of the name and have it do a match,
you can use


WHERE [GeneralManager] LIKE "*" & [Name To Match] & "*"
OR [Cashier1 LIKE "*" & [Name To Match] & "*"
OR [Cashier2] LIKE "*" & [Name To Match] & "*"
 
Using a query with "Or" between the criteria

Select * From TableName
Where [GeneralManager] = [Please enter name] Or [Cashier1] = [Please enter
name] Or [Cashier2] = [Please enter name]

The query will prompt the user to enter a name to search for

To match a partial match use "Like" instead of "="

Select * From TableName
Where [GeneralManager] Like "*" & [Please enter name] & "*" Or [Cashier1]
Like "*" & [Please enter name] & "*" Or [Cashier2] Like "*" & [Please enter
name] & "*"
 
Open your query in desugn view and enter this as criteria for
[GeneralManager] --
Like"*"& [Enter name] & "*"
Highlight the criteria and copy. Go down on row and paste as criteria for
[Cashier1] and down another row to paste for [Cashier2].
 

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

Back
Top