Thank you. This sounds like what I need to do but I don't know how to fit it
into my code. I'm using the reporttopdf coding.
Private Sub Print_Rpt_Click()
' ok lets start the record to print
Dim strWhere As String
If Me.Dirty Then 'Save any edits.
Me.Dirty = False
End If
If Me.NewRecord Then 'Check there is a record to print
MsgBox "Select a record to print"
Else
strWhere = "[ReportID] = """ & Me.[ReportID] & """"
DoCmd.OpenReport "IR_Report", acViewPreview, , strWhere
End If
' ok now lets try to export it to a PDF hopefully using the IR number in
the filename
strReportName = "IR_Report"
DoCmd.OpenReport strReportName, acViewPreview, , strWhere
Reports(strReportName).Visible = False 'hide the internal print command
Call ConvertReportToPDF("IR_Report", , _
"K:\Security 2\Reports\" & Me.ReportID & ".pdf", False, True) 'path to
location to save file with file name
DoCmd.Close acReport, strReportName
How would I run the two queries using this script?
Thank you.
dymondjack said:
Bill,
You would probably need to run two queries on the underlying data of the
form. The first one to gather information on tabs 1-5, and a second to pull
data for tab 6. Keep in mind that the form record would need to be saved
before querying these two sets of information.
That said, I would modify the code behind your print button to:
a) save the record (RunCommand acCmdSaveRecord)
b) run the two queries
c) print report #1
d) print report #2
Of course, you would need to modify the source for each report to use data
from each respective query.
I am not sure of any way to take a single report and have it print
separately (that sort of defeats the purpose of reports), but maybe someone
else knows a way other than what I've suggested.
--
Jack Leach
www.tristatemachine.com
- "A designer knows he has reached perfection not when there is nothing left
to add, but when there is nothing left to take away." - Antoine De Saint
Exupery