Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Export Snapshot rpt with VBA problem

Status
Not open for further replies.

TrollBro

Technical User
Sep 4, 2004
98
US
Hi

I have a saved report with a saved qry as the datasource with a [select ID] parameter on the ID field in the qry. I have VBA code that prompts for the ID and exports the SNP report to a folder. I do not want to open and read the report, I just want to generate and save it. However, I want to capture the [select ID] value and append it to the exported filename, but I can't figure out how. for example, the report name to save is "rpt_MyReport.snp". The [select ID] value entered is "52", I'd like the saved SNP name to be "rpt_MyReport_52.snp". Can anyone help me figure out how to do this? Below is the part of my code that might help show what I'm trying to do.

stDocName = "rpt_MyReport"

stSNPsaveName = CurrentProject.Path & "\rpt_MyReport_"

Dim SaveASstr As String
SaveASstr = stSNPsaveName '& Append the [select id] value here

DoCmd.OutputTo acOutputReport, stDocName, acFormatSNP, SaveASstr, True


Thanks
 
I have VBA code that prompts for the ID" how do you do this?
 

To be more accurate, I should say I have VBA code (DoCmd.OutputTo acOutputReport, stDocName, acFormatSNP, SaveASstr, True) that has the [select id] parameter in the where clause of the datasource (qry) for the rpt (i.e. stDocName)that prompts the user for the ID. Sorry I was confusing in how I described it.

Does that help?

Thanks
 
I wanted to be sure, my next "guess" is that in the query you use an input box. I would suggest that instead you use a form with a control box (unbound) to enter the critera, with that you could capture the ID parameter to insert in your document name.

I am going to guess that to start with you use a button to start the process to generate your report. At that point you could have it open the critera form. Then with another button on your form critera form create the report. Just set the critera of the query to the control on your form.
 

Bubba100
Actially I wasn't using a form (yet) or an input box but just runnung from the module. I think you put me on the right track - I'll give it a shot. Many thanks!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top