Search several columns with one query

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

Guest

Hi,
I have a large table with amongst other things chemical names in one column
and alias names in another. Sometimes different chemicals have the same alias
or common names. I want to be able to put a search box on a form, or set up a
query to search for a name(or partial name) that I type, in either of those
two columns, and bring up a listing of all the records that match.

Is that possible.
It seems like a simple request but is proving really difficult. I am a
novice and don't know visual basic.

I know I can manually search each column separately, or the entire database,
but that is too time consuming on a regular basis.

Appreciate your advice.
 
I think you are after something like this:
Dim strFilter As String
strFilter = "([ChemName] = """ & Me.txtFind & _
""") OR ([Alias1] = """ & Me.txtFind & _
""") OR ([Alias2] = """ & Me.txtFind & """)"
Me.Filter = strFilter
Me.FilterOn = True

Instead of repeating alias fields like that, you might consider creating a
related table to hold the alias names. You could then use a subquery in the
Filter.
 

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

Similar Threads


Back
Top