Which method has to be used in order to add a filter to a query's column?
Printable View
Which method has to be used in order to add a filter to a query's column?
More information please. What program/version/query?
I have a query in Access which generates a set of 4 fields permutations in a table (let's say PER).
One of the fields (let's say FIELD_X)can take only 6 values (let's say VAL1,...VAL5, VAL6)
I would like to have a macro which could, open the query, add a filter to FIELD_X, then run the query for VAL1 filtered, creat table PER_VAL1, then the same for VAL2... etc. In the end I should have 6 tables.
If you were using MS Access code then you would just modify the query at run timel
db.execute "Select * from PER where FIELD_1 = 'somevalue';"
db.execute "Select * from PER where FIELD_2 = 'somevalue';"
You coud do that in a loop or as many times as you like.
If you're not using code then you would add a parameter to your query. In the query designer for MS Access you would set up a parameter so that MS Access prompts you for a value at runtime and then filters against that value.
I'm getting run-time error 3065, which says I cannot execute a Select Query. My query is a Select Query type. How could I correct this?
........Code:docmd.runSql "Select * Into PER_VAL1 from PER where FIELD_2 = 'val1';"
Hope it will resolves the problem
Perfect. Thanks!