I have a report in Access that we want split and exported to .rtf based on a group ID filter. The split works, but in each .rtf file I get an extra page at the end with the page header section but no detail or group footers.
My report has the report header section hidden, page header taking up 1/2 the page, groupID header hidden, detail for each line, another group footer, group ID footer, and the page and report footers hidden.
My margins are top, left, right 0.5 inches, bottom 0.25 inches.
If I print preview from design mode or export to .rtf, there are no extra pages. Doing the same thing in VBA code is giving me different results.
Here is some of the VBA code:
' Now loop through list of labeler values and create a query for each labeler
' so that the data can be exported
Do While Not rsRptGroup.EOF
sRptGroup = rsRptGroup("reportGroupID")
'sSQL = "SELECT * FROM qry_export_cms WHERE reportGroupID = '" & sRptGroup & "'"
' exclude reportGroupID column
sSQL = "SELECT state, labeler, product, packageSize, period, name, Units, prescriptions, totalReimburse, medicaidReimb, nonmedicaidReimb "
sSQL = sSQL & "FROM qry_export_cms WHERE reportGroupID = '" & sRptGroup & "'"
qdf.sql = sSQL
sSQL = "SELECT * FROM qry_export_cms_detail WHERE reportGroupID = '" & sRptGroup & "'"
qdfDetail.sql = sSQL
On Error Resume Next ' if doesn't already exist
Kill sPath & "\rtf\" & sPrefix & sRptGroup & ".rtf" ' if already created
On Error GoTo 0 ' resume error trapping
DoCmd.OpenReport "rpt_summary", acViewPreview, , "reportGroupID='" & sRptGroup & "'", acHidden
DoCmd.OutputTo acOutputReport, "rpt_summary", acFormatRTF, sPath & "\rtf\" & sPrefix & sRptGroup & ".rtf", False, , , acExportQualityPrint
DoCmd.Close acReport, "rpt_summary"
rsRptGroup.MoveNext
Loop
Any ideas??
I tried exporting to .txt and .pdf and get the same thing, the page header repeated without detail or footer sections printed.