acoutputreport question

Access9001

Registered User.
Local time
Today, 03:26
Joined
Feb 18, 2010
Messages
268
DoCmd.OutputTo acOutputReport, "Report_Name", acFormatSNP, "C:\somepath\filename.snp"

The line above is outputting a snapshot, but the report is based on a query that depends on user input. That is to say, when I try to run this, it'll prompt me to enter in a value for the variable "Input" so that it'll churn out the rest of the report.

How can I add that field in this code so that I can specify what I want "Input" to be when this line runs? Thanks.
 
One way is to put a parameter in the report query that prompts the user.
 
I have a parameter in the recordsource that the Report draws from, where it basically ends with: "Where field=[Input]"

I just want to be able to programatically/automatically pass in what I want [Input] to be when I output this report.
 
In the query if you put your user prompt message in square brackets in the appropriate column it will put what ever the users enters as the criteria.
 
I have the square brackets already -- but I don't want this to be a user-input execution. The query is dynamic, as I don't want to make a billion separate reports for exporting each type of what I need. I simply want to be able to pass in a value for the variable in the code.

I have an array + for-each loop that will be cycling through a variety of "Inputs" to pass into this outputto command, but I just need some way of actually doing it.
 
Oh, I got it backwards. Hum....

One way would be to build the sql string with code and base the report that.
 
Oh, I got it backwards. Hum....

One way would be to build the sql string with code and base the report that.

That might work -- how can I change the recordsource of the report dynamically?
 
In the report on open event:

Me.RecordSource = mySQLString
 
So if I put that line in the Open event, and I have a separate function that does the outputto command, how do I pass in that sql string?
 
You build the sql string in the event module.
 

Users who are viewing this thread

Back
Top Bottom