2010 Macro Builder - pass parameters from form through steps

soulice

Registered User.
Local time
Today, 14:19
Joined
Dec 21, 2011
Messages
41
I have a form with 3 fields and a button. On button click I need to run a macro that calls 3 queries in order. The 2nd and 3rd need 3 parameters, thus the form. How can I pass them in?
Fill out form, click button, run delete query, run 2 append queries that need parameters then finally open a report that shows data from table that is now cleaned and loaded.

I can do it all except the params. I do not want the user prompted for each parameter...
 
You can reference the form in the query criteria.
 
So edit the query object to take the values from the form? (not using a sql string) I will edit the criteria field on my query design and keep you posted.
 
Worked like a charm. Thanks! Can you do the same in a Report with the same form open? Can you get the displayed value from the combo box and not the ID (use ID for query, need displayed value for report)?
 
Typically you would base the report on a query that joined the two tables together, enabling it to use/return both ID and text values. You could refer to the form/combo box from the report, but it wouldn't be the way I went.
 
Actually, and I know this probably is not the right way, I have a table. This table is cleared by a delete query, then filled via 2 append queries as the data is coming from different tables and some other data manipulation is taking place. Then I have a query against that table that the report is based on. This all happens from a form page button click after choosing 3 parameters. I then want to display the displayed text value of the combo box on the resulting report.
 
Probably not what I would do, but why not add the field to your table and have one of your queries populate it? Or on the report:

=Forms!FormName.ComboName.Column(1)

or whatever the appropriate column number is.
 

Users who are viewing this thread

Back
Top Bottom