Can't wrap my head around this, if I run a report (which has a sub report embedded in it - not sure if that's relevant), when I view the report in MS access 2013 (Report View), it looks fine....i.e. one page long.
However, if I then use a bit of VBA to email the same report, like thus...
DoCmd.SendObject acSendReport, "rptSalesReceiptMain_UK", acFormatPDF, DLookup("[Email]", "[Sales]", "[EmailInvoice]=True"), , , "Subject", "Body", True
....the resulting pdf file is 4 pages long (only the first page has the data that I require on it). I don't think it's possible to select only page 1 of the report (the report should only ever be 1 page long) ...so I have to get to the bottom of this somehow or other!
I'm lost....top tips warmly received!
(incidentally, all that dlookup is doing in the DoCmd.SendObject line is finding a row in my table where "EmailInvoice" is set to true, & then uses the email address contained in the same row)
Report view = 1 page (good), but VBA emailing same report = 4 pages (bad!)
However, if I then use a bit of VBA to email the same report, like thus...
DoCmd.SendObject acSendReport, "rptSalesReceiptMain_UK", acFormatPDF, DLookup("[Email]", "[Sales]", "[EmailInvoice]=True"), , , "Subject", "Body", True
....the resulting pdf file is 4 pages long (only the first page has the data that I require on it). I don't think it's possible to select only page 1 of the report (the report should only ever be 1 page long) ...so I have to get to the bottom of this somehow or other!
I'm lost....top tips warmly received!
(incidentally, all that dlookup is doing in the DoCmd.SendObject line is finding a row in my table where "EmailInvoice" is set to true, & then uses the email address contained in the same row)