By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,960 Members | 2,232 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,960 IT Pros & Developers. It's quick & easy.

Query Criteria

P: 64
Is there a method to pass along a criteria argument directly to the query criteria rather than through filtering a form or report?

In other words, I would like to click a "print" button and in the "on click" procedure pass along the criteria to the query to generate this report. Then I wouldn't have to create so mahy different queries. I know that I can take a control value to use in the criteria box in the query. But I would like to be able to use that same query from several different forms. I hope I'm not overlooking the obvious.

Thanks

-Tom
Nov 30 '07 #1
Share this Question
Share on Google+
4 Replies


Rabbit
Expert Mod 10K+
P: 12,366
Is there a method to pass along a criteria argument directly to the query criteria rather than through filtering a form or report?

In other words, I would like to click a "print" button and in the "on click" procedure pass along the criteria to the query to generate this report. Then I wouldn't have to create so mahy different queries. I know that I can take a control value to use in the criteria box in the query. But I would like to be able to use that same query from several different forms. I hope I'm not overlooking the obvious.

Thanks

-Tom
You could use global variables. But to call a global variable from a query you also need a function to return the value.
Nov 30 '07 #2

P: 64
You could use global variables. But to call a global variable from a query you also need a function to return the value.
How would you create a global variable and what can you give me a short version of code to create the function?

Thanks

-Tom
Dec 1 '07 #3

Rabbit
Expert Mod 10K+
P: 12,366
It's global as long as you put it in a non form module.
Dec 3 '07 #4

MMcCarthy
Expert Mod 10K+
P: 14,534
Also instead of using Dim to declare your variable you declare it with the word Public.

e.g.

Public str As String
Dec 11 '07 #5

Post your reply

Sign in to post your reply or Sign up for a free account.