If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Temp Variable for Criteria in Query Design
Is there a way to reference a set Temp. Variable in Access 07's query design
under criteria. In VBA, I can call a temp variable and use it in a query built at run time, but I am looking to use this query without having to hard code it. Is this possible? Any thoughts would be greatly appreciated. -- Message posted via http://www.accessmonster.com |
#2
|
|||
|
|||
Temp Variable for Criteria in Query Design
On Jun 19, 3:26 pm, "Chris F via AccessMonster.com" u19217@uwe
wrote: Is there a way to reference a set Temp. Variable in Access 07's query design under criteria. In VBA, I can call a temp variable and use it in a query built at run time, but I am looking to use this query without having to hard code it. Is this possible? Any thoughts would be greatly appreciated. -- Message posted viahttp://www.accessmonster.com There are limitations (which I don't recall right away), but you can use a variable in the following fashion. For a Table1 that has the sole field fname, to get a list of unique field values: SELECT [foo] AS Expr1, fname FROM Table1 GROUP BY [foo], fname HAVING fname=[foo]; When you run this in Access (97-2003 at least) it will prompt you for the value, and use what you type in as the criteria. Is that what you meant? (Note, I included [foo] in the SELECT clause but it can be removed here) BTW, if you like this, extending it for wildcards can be rewarding: Like "*" & [foo] & "*" I can repeatedly "search" that way - very fast - because I don't have to create new queries for different criteria. |
Thread Tools | |
Display Modes | |
|
|