Haven't bothered to test, but you should be able to do something like:
Set rpt = CreateReport
rpt.Name = "rptMyNameHere"
' put the rest of your code here
DoCmd.Close acReport, rpt.Name, acSaveYes
--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)
"Jeff Conrad" wrote in message
...
Hi,
Using Access 97 at the moment.
After building a report in code using CreateReport and CreateReportControl
coding I wish to save the report without being prompted for the name. Fine
enough I can do that by using code like this at the end:
DoCmd.Close acReport, rpt.Name, acSaveYes
But, how do I save the report with a name of my choosing without being
prompted?
Right now it saves it as Report1 or Report2, etc.
I have already assigned a caption for the report so I assumed it would
save
the report with that name. I was incorrect.
If I try something like this:
DoCmd.Close acReport, "rptMyNameHere", acSaveYes
Access says it can't find that report.
Is this not possible to do?
Do I have to save the report with the default name and then rename it in
code?
Thanks,
--
Jeff Conrad
Access Junkie
Bend, Oregon