Hi Everyone,
Today I write asking your support on this
I have this code to show a report and print this as pdf, but I want to use a criteria into the statement DoCmd.Output and I do not know how to do it. I highly appreciate your support
************************************************** ***************
Dim stDocName As String
Dim stLinkCriteria As String
Dim stFileName As String
stDocName = "Diagram_ABC"
stLinkCriteria = "[ID]=" & "'" & Me.ID & "'"
stFileName = CurrentProject.Path & "" & stDocName & Format(Date, "YYYYMMDD") & ".pdf" 'set the file name for the new PDF
'IF I want to open I use this line below according to my criteria
DoCmd.OpenReport stDocName, acViewNormal, , stLinkCriteria
'I want to print the report as pdf and I am using this line, the issue is that I don't know how to insert the criteria as line here below
'DoCmd.OutputTo acOutputReport, stDocName, acFormatPDF, stFileName, True
'Somebody give a recommendation that I should modifiy the report to include the criteria into its record source and save it with another name
'it is an awesone idea and works pretty good, the only concern is that I don't want to create a lot of double reports with this concept;
'for me would be better to insert the criteria
'any idea? Thanks!!!!
MsgBox "Report to PDF", vbInformation, "Exporting to PDF"
Exit_ImprimirPapelcmd_Click:
Exit Sub
Err_ImprimirPapelcmd_Click:
MsgBox Err.Description
Resume Exit_ImprimirPapelcmd_Click