I've installed a virtual printer that allows me to save access reports as .pdf files. Within Access (using VBA) I'm using the DoCmd.OpenReport action to send the file to be printed. When I do this a pop up box appears asking me for the path and name of the file to be saved.
Since I'm trying to automate this process, how do I set these parameters programatically in VBA?
Below is an excerpt of the code I have so far.
Expand|Select|Wrap|Line Numbers
- Function CutReports()
- Dim rsContacts As New ADODB.Recordset
- Dim RPTPAN As Access.Report
- Dim strName As String
- rsContacts.ActiveConnection = CurrentProject.Connection
- rsContacts.Open "QRY12MoReviewNewMIPNo"
- Do While Not rsContacts.EOF
- 'Send data for this active record to Report and save as PAN.pdf
- strName = rsContacts!EEFullName
- DoCmd.OpenReport "RPTPAN", acViewNormal, , "[EEFullName] = '" & strName & "'"
- ‘Here is where I’m stuck. I need to dictate where and under what name to save the file.
- DoCmd.Close acReport, "RPTPAN", acSaveNo
- 'Move to the next person in the recordset
- rsContacts.MoveNext
- Loop