This may not be possible, but here goes...
I have a form from which I want to output the results of a number of queries into Excel spreadsheets. But I want the queries to run from one parameter (an 'earliest date') which is input into a textbox on the form. I've managed to get it all working hunky dorey as a number of parameter queries, but this involves the user typing in the same date six times! Is it possible to use the DoCmd.OutputTo method to output from the queries whilst adding an SQL "where" clause which acts as a parameter? Here's a snippet of code so far:
etc.
I'd like to somehow add
to the statements... I'm just not sure if I'm having a syntactical problem, or I need to go another way around it - maybe change the queries to Make Table queries, pass the textbox value to them, then output the resulting tables to Excel?
Any thoughts?
42??? We're going to get lynched!
I have a form from which I want to output the results of a number of queries into Excel spreadsheets. But I want the queries to run from one parameter (an 'earliest date') which is input into a textbox on the form. I've managed to get it all working hunky dorey as a number of parameter queries, but this involves the user typing in the same date six times! Is it possible to use the DoCmd.OutputTo method to output from the queries whilst adding an SQL "where" clause which acts as a parameter? Here's a snippet of code so far:
Code:
DoCmd.OutputTo acOutputQuery, "DEPT_LEAVERS_OUTPUT", acFormatXLS, "C:\WINNT\DEPT_LEAVERS_OUTPUT.xls"
DoCmd.OutputTo acOutputQuery, "DEPT_STARTERS_OUTPUT", acFormatXLS, "C:\WINNT\DEPT_STARTERS_OUTPUT.xls"
I'd like to somehow add
Code:
"WHERE Start_D >=" & Me.TxtDate
Any thoughts?
42??? We're going to get lynched!