Wildcard character in MS Query

G

Grd

Hi There,

I'm using a parameter for eg [Please enter City] in my MSQuery connecting to
my SQL SErver database. How do I allow for an all option. I think it is using
a wildcard but can't quite figure it out.

Any help greatly appreciated

Gordon
 
R

Ron Coderre

If your SQL is set up to use the LIKE operator, the code will accommodate
anything your parameter specifies.

Example:
WHERE City LIKE [Please enter City]

If the parameter equals: Paris
Only "Paris" entries will be returned.

However, if the parameter is: P*
All cities beginning with "P" will be returned.

Note: you may need to change the wildcard character to suit your DB.

Does that help?
Post back if you have more questions.
--------------------------

Regards,

Ron (XL2003, Win XP)
Microsoft MVP (Excel)


Just an asterisk returns all cities.
 
G

Grd

Thanks

Will give that a go

Ron Coderre said:
If your SQL is set up to use the LIKE operator, the code will accommodate
anything your parameter specifies.

Example:
WHERE City LIKE [Please enter City]

If the parameter equals: Paris
Only "Paris" entries will be returned.

However, if the parameter is: P*
All cities beginning with "P" will be returned.

Note: you may need to change the wildcard character to suit your DB.

Does that help?
Post back if you have more questions.
--------------------------

Regards,

Ron (XL2003, Win XP)
Microsoft MVP (Excel)


Just an asterisk returns all cities.
Grd said:
Hi There,

I'm using a parameter for eg [Please enter City] in my MSQuery connecting
to
my SQL SErver database. How do I allow for an all option. I think it is
using
a wildcard but can't quite figure it out.

Any help greatly appreciated

Gordon
 
Top