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

multiple queries with single parameter input

P: 5
I have a database in Access2003. I have set up several queries that use the parameter entry [Enter serial number, SN:]. Each query produces different outputs from various tables that go into a report. Sometimes, a report calls for more than one query using the same serial number. Is there a way to not require the operator to input that same parameter for every query short of building a hugh query for all the data for that report? For a group of queries, I envision the SN parameter input once to single variable that gets assigned to the parameter. I'll probably need to code this myself but I would not know where to begin as I have never used macros or modules. I've never used these objects in Access.


Mar 12 '07 #1
Share this Question
Share on Google+
1 Reply

Expert Mod 15k+
P: 31,429
There are two ways this is normally done. Both include setting up a form (which would need to be open when the query/report is run) to contain the value replacing the parameter. if we call the form [frmParam] then we know what we're talking about.
  1. The SQL of the query can reference the control from the form directly. Say you had a TextBox control on your form called txtParam, then this would refernced as Forms!frmParam.txtParam (or even Forms("frmParam").txtParam if preferred).
  2. Within the code of your form there would be code to open the report (or action query) directly. This would be done in such a way as to pass the value of the control as a literal value. This can be done in various ways including recreating the SQL of a query and inserting the value in the relevant position and including passing a WhereCondition for a report.
Mar 13 '07 #2

Post your reply

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