Save existing report under new name programmatically?

Lol Owen

Registered User.
Local time
Today, 23:14
Joined
Mar 15, 2004
Messages
86
Hi all, am working on something at the minute where I open an existing report, change it's source code to an SQL statement, and print it out. However, I would like to save the report under a new name leaving my original report as a template for next time. I can't find any reference to a SaveAs method of the DoCmd object. Any thoughts as to how I could do this please?

Cheers, Lol :D
 
LOL,

If all you're changing is the SQL for the report's record source, then shouldn't
you look at QueryDefs? You're not really changing the format/appearance of
the report. You can just have a collection of queries that drive the report.

Wayne
 
Hi wayne, never played with Querydefs, but I would like to be able to do this for archival purposes. Am creating a system for a non-computer literate person running a small business (actually it's for my industry project at college) so having the reports saved under different names would be the way to go. i think it could be done using objects. i could create a report object, but how would I go about setting the object to be "equal" for want of a better word to the existing report template? from there it would be a matter of doing a SaveAs for the report object.

Cheers, Lol
 
Going along with the idea that things that grow over time should grow in rows...
You could have a table to store these varying SQL strings, in which the user could name them for later use.
This way, the user could make a new report criteria or use a saved one. You can change the report's record source or the querydef at runtime.
 
It's definitely an option for future projects but I'm running out of time on this one so I'll go with what I've got. Thanks for your advice so far.

Cheers, Lol :D
 

Users who are viewing this thread

Back
Top Bottom