query using this criteria or that

  • Thread starter Thread starter papa jonah
  • Start date Start date
P

papa jonah

I have a query that has multiple fields.
I want to select "*electr*" as criteria for two seperate fields in the
query. What I hope for is for records to show up with *electr* in one
or both of the fields. Instead none of the records are showing up.
There must be a way to do this that I am not trying. Any help would be
much appreciated. TIA
 
WHERE Field1 Like "*electr*" Or Field2 Like "*electr*"

Replace 'Field1' and 'Field2' with the actual names of your fields.
 
I am not sure what you mean. In design view for the query, the fields
have names.
The first one is "Type" and the second one is "Subreason".
 
In query design mode -

Put the criteria - Like "*electr*" in line1 under criteria
then put the same criteria in 'OR/line2' under criteria

hope this makes sense
 
In the 'Type' column, enter the criteria in the 'Criteria' row. In the
'Subreason' column, go down one row, and enter the criteria in the first
'Or' row.

If you enter the criteria on the same row in both columns, that is
interpreted as Type = criteria And Subreason = criteria, instead of Type =
criteria Or Subreason = criteria.

BTW: If you want to know what I meant in the earlier post, open your query
in design view, then choose SQL View from the View menu.
 
I have a query that has multiple fields.
I want to select "*electr*" as criteria for two seperate fields in the
query. What I hope for is for records to show up with *electr* in one
or both of the fields. Instead none of the records are showing up.
There must be a way to do this that I am not trying. Any help would be
much appreciated. TIA

You can get OR logic (which is what you need here) by putting the
criteria for the two fields on two separate lines in the Criteria part
of the query grid. Or, you can switch to SQL view and use Brendan's
query - the SQL is "the real query", and the grid is just a tool to
help build SQL.

Just FWIW, it's worthwhile getting acquainted with SQL view; for one
thing, it's much easier to post queries in SQL to these newsgroups,
and for another, it's possible to do some queries in SQL view which
cannot be done in the grid.

John W. Vinson[MVP]
 
Back
Top