SQL & Like Parameters

  • Thread starter George Applegate
  • Start date
G

George Applegate

I would like to have the operator prompted for a "like" value. For
instance, I would like the operator to be prompted to enter the word
PUSH if the description field contains PUSH anywhere in the
description.
This is a query using microsoft query which returns data to excel.
For normal parameter queries you enter in the criteria something like
[Enter value to search for]. That works on queries for "equal"
conditions, but I can't figure out how to prompt for a "Like"
condition that I want the user to be able to enter the parameter for.

For instance I think I need to enter something like:

Like "'%"[Enter value to search for]"%'" but that doesn't seem to
work. I could write this in the SQL native if someone could give me an
idea how to do that too, since the query criteria eventually gets
generated into SQL anyway.

Can anyone help me? This is a unique situation because of the LIKE
and wild-card symbols.

thanks,
ga
George Applegate
(e-mail address removed)
 
R

Randi

Just a dump idea until you get a better one - you could have the criteria be:
Like [Enter Data]

Then when the enter parameter value box appears type Data%

For example if you are looking for a number that begins with 7:

Enter Data: 7%

This will bring up the needed info.
 
G

George Applegate

Randi -

This worked sort of...Once the query was created, in order to get a
prompt message (I have two parms I'm prompting for) I had to go into
the spreadsheet under Tools/Macro/Microsoft script editor and add the
prompt string I wanted to show in the prompt box.

But at least it is working . Thanks a ton for your suggestion and
assistance. Putting in the % sign isn't a big price to pay.

ga

Randi said:
Just a dump idea until you get a better one - you could have the criteria be:
Like [Enter Data]

Then when the enter parameter value box appears type Data%

For example if you are looking for a number that begins with 7:

Enter Data: 7%

This will bring up the needed info.

George Applegate said:
I would like to have the operator prompted for a "like" value. For
instance, I would like the operator to be prompted to enter the word
PUSH if the description field contains PUSH anywhere in the
description.
This is a query using microsoft query which returns data to excel.
For normal parameter queries you enter in the criteria something like
[Enter value to search for]. That works on queries for "equal"
conditions, but I can't figure out how to prompt for a "Like"
condition that I want the user to be able to enter the parameter for.

For instance I think I need to enter something like:

Like "'%"[Enter value to search for]"%'" but that doesn't seem to
work. I could write this in the SQL native if someone could give me an
idea how to do that too, since the query criteria eventually gets
generated into SQL anyway.

Can anyone help me? This is a unique situation because of the LIKE
and wild-card symbols.

thanks,
ga
George Applegate
(e-mail address removed)

George Applegate
(e-mail address removed)
 

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