Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Access Query, using a "wlid card" 1

Status
Not open for further replies.

jaredc

Programmer
Jun 28, 2002
43
GB
Hi, I'm new to this forum and hope someone can help with my (hopefully) quite simlpe query.

I'm got an access query which i'm calling from my web page, which has two parameters. I'd like to be able to specify the option of "selecting all" (i.e. not supplying a specific parameter but return all fields) in my second parameter.

For some resaon I'm thinking along the lines of using the "%" character, but so far haven't had any joy.

Hope my question makes sense and thanks in advance for any thoughts or advice.
 
Hi Mike,

In the Where clause of your SQL statement, instead of using "=" use "Like" then you'll be able to use * to search for everything.

Example:

SELECT somefield, someotherfield FROM someTable
WHERE (somefield LIKE []) AND (someotherfield LIKE [])

To do this in a query design view just put LIKE [] in the criteria.

Hope this helps,

Pete
 
Thanks Pete, that was just what I was after!

Cheers, Mike
 
I think i said thanks to quickly! When I'm running the query from inside access entering "*" works fine, but when i try and run the query from the web page it seems to be taking the "*" literally, i.e. as a value rather than as a "wild card". Do i need to convert the * to some other format before i can attached it as a parameter?

I'm currently doing this:

strPly = "*"

cmdQuery.Parameters.Append paramPly
cmdQuery.Parameters("@Ply") = strPly

Or maybe there's some other very obvious problem that i've got! Again, i hope this makes sense and thanks in advance for your advice

Mike
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top