Passing same parameter value from 3 different forms

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a query requiring parameter to generate report
Instead of using pop-up input box, I wish to use control field in 3 forms (e.g. [ID_no]) to pass the parameter to the query
Since the parameter may come from different forms, I cannot use the following to pass on the parameter value

[forms]![formName]![ControlName

Is there any other method to pass the parameter value to query, such as using VBA
Thank you very much for your help.
 
Using VBA, with DAO or ADO, you can use the parameter property to define the
parameters.

In most cases, especially when reports are the goal, I prefer to create the
SQL String in code, and populate a table with the data. The report is based
on the table. So, there are two steps to the report, the first is the data
generation, and the second is the running of the report.

I tend to keep the tables, meaning empty and populate, rather than using a
Make Table query.

--
HTH,

Steve Clark, Access MVP
FMS, Inc.
Professional Solutions Group
http://www.FMSInc.com
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Is your Access database too slow?
Are you ready to upgrade to SQL Server?
Contact us for optimization and/or upsizing!
http://www.FMSInc.com/consulting
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

Eric said:
I have a query requiring parameter to generate report.
Instead of using pop-up input box, I wish to use control field in 3 forms
(e.g. [ID_no]) to pass the parameter to the query.
Since the parameter may come from different forms, I cannot use the
following to pass on the parameter value:
[forms]![formName]![ControlName]

Is there any other method to pass the parameter value to query, such as using VBA?
Thank you very much for your help.
 
You could use a custom function to test which form was open and return the value
from the appropriate form.

OR

You could set a global variable from the form and then get the value for the
query using a function

OR

You could open a second form (visible property set to no) and set a control on
it whenever you set the control's value on the first form. Then you could
reference the 2nd form's control in your query

OR

....
 
Back
Top