Query search

R

ryan.fitzpatrick3

I download a list of information onto a table, and i'd like to make a
search on that item. I put in "*" & [Search Item] & "*" into the
item field with the wildcards just in case. This works fine. Now lets
say I'm looking up cars, so in the search input box that pops run when
I run the query I type in dodge and that brings backs dodge matches.
If I want to look up red dodges do I put

like "red" and "*" & [Search Item] & "*" or "red" &"*" & [Search Item]
& "*" ?

I've tried both and it works only if red dodge is next to each other
but if it's red white dodge, it wouldn't pick that item up. Is there
away to program a color into the search field where it would bring
back all red dodges even though the words are not next to each other?

Also can I type in two colors like "red" or "yellow" and "*" & [Search
Item] & "*"

and lookup mutliple colors? Thank you.

Ryan
 
C

cttechsupport

Ryan,

You may want to investigate the Instr() function
the syntax (short form) is .........

Instr ( string_being_searched, string_you_aresearching_for )

The function returns the starting position of the search string - or 0
if not found

So if your field holding the text was called [CarDesc] and the
contents of a record were for example"
"Red & White Dodge Charger"

A sample query could look like this...........

IIF((Instr([cardesc],"red")>0 and Instr([cardesc],"white")>0 and
Instr([cardesc],"dodge").0),"Found one", "sorry none available")

The result here of course will permit ANY of the terms to be found in
ANY position ! Need to keep that in mind.

Good luck

Charlie
 
R

ryan.fitzpatrick3

Will it list all of the matches for "Red" "Dodge" instead of saying
there is a match?


Ryan,

You may want to investigate the Instr() function
the syntax (short form) is .........

Instr ( string_being_searched, string_you_aresearching_for )

The function returns the starting position of the search string - or 0
if not found

So if your field holding the text was called [CarDesc] and the
contents of a record were for example"
"Red & White Dodge Charger"

A sample query could look like this...........

IIF((Instr([cardesc],"red")>0 and Instr([cardesc],"white")>0 and
Instr([cardesc],"dodge").0),"Found one", "sorry none available")

The result here of course will permit ANY of the terms to be found in
ANY position ! Need to keep that in mind.

Good luck

Charlie

I download a list of information onto a table, and i'd like to make a
search on that item. I put in "*" & [Search Item] & "*" into the
item field with the wildcards just in case. This works fine. Now lets
say I'm looking up cars, so in the search input box that pops run when
I run the query I type in dodge and that brings backs dodge matches.
If I want to look up red dodges do I put
like "red" and "*" & [Search Item] & "*" or "red" &"*" & [Search Item]
& "*" ?
I've tried both and it works only if red dodge is next to each other
but if it's red white dodge, it wouldn't pick that item up. Is there
away to program a color into the search field where it would bring
back all red dodges even though the words are not next to each other?
Also can I type in two colors like "red" or "yellow" and "*" & [Search
Item] & "*"
and lookup mutliple colors? Thank you.
 
J

John Spencer

LIKE "*Red* Dodge*" or Like "*Dodge* Red*"

OR

Like ""*RED*" and Like "*Dodge*"

--
John Spencer
Access MVP 2002-2005, 2007-2008
Center for Health Program Development and Management
University of Maryland Baltimore County
..
 

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

Top