Passing "OR" into a Parameter query

  • Thread starter Thread starter Guest
  • Start date Start date
Hi,


Make a table with one field, two records, one with the numerical value 18,
one with 88. Add more records if more values are desired, without duplicated
values.

Use an inner join to make the intersection:

SELECT myTable.*
FROM myTable INNER JOIN previousTable
ON myTable.FieldName = previousTable.itsFieldName



That is probably one of the most versatile solution that can handle a lot of
records (if you add an index) too.



Hoping it may help,
Vanderghast, Access MVP
 
No you can't, the query will use it as one criteria, and it will look for
records that has "18 or 88" and it won't treat each number as individual.

But if you are using a form, where the use enter the parameter in a text
field, then using code you can change the SQL in the query to include the
filter.
So, for example, if the user enter 8,88
then you can use the code

application.CurrentDb.QueryDefs("QueryName").SQL="Select * From TableName
Where FieldName In(" & Me.[TextFieldNameInTheForm] & ")"
 
Back
Top