Passing Parameters during DoCmd.OutputTo

ctags009

Registered User.
Local time
Today, 06:52
Joined
Nov 2, 2011
Messages
25
Hi all -

I'm looking to pass a parameter (a Dlookup function) to my query during the "OutputTo" command (or really anytime I want to call the query, but for now this is what I'm doing)

My query is to be filtered base on a date however, I'm not sure how I can set the value of the parameter without having to type it in to the popup prompt....

I'm sending the records of multiple queries to an excel file - Everything works fine, except I have to manually type the date for each query I'm outputting

Any help/suggestions would be appreciated

Thanks
 
On the form where you click the button to execute outputto command, create a date text box. Then link this text box to all those queries. In this case, all queries will consider the date you have provided in the textbox. From link I mean something like, if the OutPutTo command button is on Form1 and the date text box's name is OutputDate, then your expression in each query under the date field should look like;

Code:
=Forms![Form1]![OuputDate]
 
You can't enter the parameter via OutputTo so you have to change the parameter to a full reference to the textbox that holds the value.
 
You can't enter the parameter via OutputTo so you have to change the parameter to a full reference to the textbox that holds the value.

Okay, yeah, I figured I would have to go with a textbox as Dhamdard had mentioned, I suppose its the same either way, was just wondering if it could be done within the button's onclick event rather than in the query itself

Thanks!
 
I didn't notice he mentioned that because he prefixed the field with "=".

Just do it directly and use the form as your pop-up parameter.
 

Users who are viewing this thread

Back
Top Bottom