[AccessD] Make pdf report
Doug Steele
dbdoug at gmail.com
Mon Oct 10 12:42:24 CDT 2016
Hi Rocky:
You don't mention which version of Access you're using. Here is some
Access 2010 code I use, which also applies a filter string to the report
before outputting, and deals with a weird bug I've found in the SQL string
for reports, where sometimes there is a semicolon at the end, and sometimes
not:
DoCmd.OpenReport RName, acViewDesign, , , acHidden
SqlStr = Reports(RName).Report.RecordSource
'is there a semicolon at the end? Is this an access 2010
difference?
If InStr(SqlStr, ";") > 0 Then
SqlStr = Left(SqlStr, InStr(SqlStr, ";") - 1)
End If
If FilterStr <> "" Then
' insert custom where string before order by
i = InStr(SqlStr, "ORDER BY")
If i <> 0 Then
SqlStr = Left(SqlStr, i - 1) & "WHERE " & FilterStr & " " &
Right(SqlStr, Len(SqlStr) - i + 1)
Else
SqlStr = SqlStr & " WHERE " & FilterStr
End If
End If
Reports(RName).Report.RecordSource = SqlStr
MyPath = PDFPath & FName & ".pdf"
DoCmd.OutputTo acOutputReport, RName, acFormatPDF, MyPath
On Mon, Oct 10, 2016 at 10:24 AM, Rocky Smolin <rockysmolin at bchacc.com>
wrote:
> Dear List:
>
>
>
> I developed some code to create a report as a pdf and attach it to an email
> many years ago in A2003. It doesn't work any more.
>
>
>
> Is there a 'moderne' way to accomplish this? Sending the attachment by
> email
> is, I think the less important part of the task - getting the report output
> in pdf form is the sticker.
>
>
>
> MTIA
>
>
>
>
>
> Rocky Smolin
>
> Beach Access Software
>
> 760-683-5777
>
> <http://www.bchacc.com> www.bchacc.com
>
> <http://www.e-z-mrp.com> www.e-z-mrp.com
>
> Skype: rocky.smolin
>
>
>
>
>
> --
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com
>
More information about the AccessD
mailing list