Can I query using 2 *

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

Guest

I have a Book Database with one field named Titles.
Is it possible to make a query using 2 partial names in the field name to
get all the matching items I want in one query?
For example, *Gone* (Gone Fishing, Gone with the Wind, Gone Crazy, etc) and
*Parenting*(for Modern Day Parenting, Good Parenting Skills, Parenting a
Teenager, etc), so I get all 6 Book Titles ?
I tried Like "*" Or [Enter Partial Title of Book] & "*" but it returns
the entire database's Book Titles. Help.
 
I have a Book Database with one field named Titles.
Is it possible to make a query using 2 partial names in the field name to
get all the matching items I want in one query?
For example, *Gone* (Gone Fishing, Gone with the Wind, Gone Crazy, etc) and
*Parenting*(for Modern Day Parenting, Good Parenting Skills, Parenting a
Teenager, etc), so I get all 6 Book Titles ?
I tried Like "*" Or [Enter Partial Title of Book] & "*" but it returns
the entire database's Book Titles. Help.

To find the phrase anywhere in the field:
Like "*" & [Enter Partial Title of Book] & "*"

To find the phrase only at the beginning of the field:
Like [Enter Partial Title of Book] & "*"

To find the phrase only at the end of the field:
Like "*" & [Enter Partial Title of Book]
 
Try the following

WHERE Title Like "*" & Nz([Enter Partial Title of Book],"xjxjyz") & "*"
OR Title Like "*" & NZ([Enter Second Partial],"xjxjyz") & "*"

If you are using the query grid you would have to use two parameters on two
lines
Field: Title
Criteria(Line1): Like "*" & Nz([Enter Partial Title of Book],"xjxjyz") & "*"
Criteria(Line2): Like "*" & Nz([Enter Second Partial],"xjxjyz") & "*"

The NZ puts xjxjyz into the search string if you leave the prompt blank. If
you didn't put in a nonsense string, then you would end up matching all
titles in the database.
 
John, I love you.
Geez, you guys on this Discussion Group are Blindingly Brilliant.
Thank you, Thank you, Thank you.
How did you know about putting the gibberish in the query ??


John Spencer said:
Try the following

WHERE Title Like "*" & Nz([Enter Partial Title of Book],"xjxjyz") & "*"
OR Title Like "*" & NZ([Enter Second Partial],"xjxjyz") & "*"

If you are using the query grid you would have to use two parameters on two
lines
Field: Title
Criteria(Line1): Like "*" & Nz([Enter Partial Title of Book],"xjxjyz") & "*"
Criteria(Line2): Like "*" & Nz([Enter Second Partial],"xjxjyz") & "*"

The NZ puts xjxjyz into the search string if you leave the prompt blank. If
you didn't put in a nonsense string, then you would end up matching all
titles in the database.


Tall Mary said:
I have a Book Database with one field named Titles.
Is it possible to make a query using 2 partial names in the field name to
get all the matching items I want in one query?
For example, *Gone* (Gone Fishing, Gone with the Wind, Gone Crazy, etc)
and
*Parenting*(for Modern Day Parenting, Good Parenting Skills, Parenting a
Teenager, etc), so I get all 6 Book Titles ?
I tried Like "*" Or [Enter Partial Title of Book] & "*" but it returns
the entire database's Book Titles. Help.
 
Best I can say is experience. I've been doing this quite a while.


Tall Mary said:
John, I love you.
Geez, you guys on this Discussion Group are Blindingly Brilliant.
Thank you, Thank you, Thank you.
How did you know about putting the gibberish in the query ??


John Spencer said:
Try the following

WHERE Title Like "*" & Nz([Enter Partial Title of Book],"xjxjyz") & "*"
OR Title Like "*" & NZ([Enter Second Partial],"xjxjyz") & "*"

If you are using the query grid you would have to use two parameters on
two
lines
Field: Title
Criteria(Line1): Like "*" & Nz([Enter Partial Title of Book],"xjxjyz") &
"*"
Criteria(Line2): Like "*" & Nz([Enter Second Partial],"xjxjyz") & "*"

The NZ puts xjxjyz into the search string if you leave the prompt blank.
If
you didn't put in a nonsense string, then you would end up matching all
titles in the database.


Tall Mary said:
I have a Book Database with one field named Titles.
Is it possible to make a query using 2 partial names in the field name
to
get all the matching items I want in one query?
For example, *Gone* (Gone Fishing, Gone with the Wind, Gone Crazy, etc)
and
*Parenting*(for Modern Day Parenting, Good Parenting Skills, Parenting
a
Teenager, etc), so I get all 6 Book Titles ?
I tried Like "*" Or [Enter Partial Title of Book] & "*" but it
returns
the entire database's Book Titles. Help.
 

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