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 wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Multiple parameter fields and crosstabs

Status
Not open for further replies.

hyperiest

Technical User
Dec 26, 2002
35
US
Well, I just about have this x-tab thing down, but I am still floundering on how to write an SQL statement to include parameters (with wildcards) in more than one field within the query. I have had success creating parameterized crosstab queries with parameterized select queries on them, but when I use the wildcard statement for either the first or the second parameter, it ignores the other parameter values.

For example, if I specify the parameters as such:

PARAMETERS [Field1_Value] Text (255), [Field2_Value] Text (255);
SELECT MyTable.Field1, MyTable.Field2
FROM MyTable
WHERE InStr([Field1_Value],[Field1])>0 OR InStr([Field1_Value],[Field1]) IS NULL AND InStr([Field2_Value],[Field2])>0 OR InStr([Field2_Value],[Field2]) IS NULL;

and if I specify Value1 for Field1_Value and hit enter (or enter a null value) for Field2_Value, it will return all values for both parameters, even though I specified the value for Field1.

Short of writing two queries to accomplish this, is there any way to accomplish it with only one query?

Your help is always appreciated.

Captain D
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top