[AccessD] Make pdf report
Rocky Smolin
rockysmolin at bchacc.com
Mon Oct 10 13:43:57 CDT 2016
Thanks. Similar to Chester's. I think that OutPut To may not have been in
2003? Otherwise I should have used it. This is going to be A2010.
R
-----Original Message-----
From: AccessD [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of
Doug Steele
Sent: Monday, October 10, 2016 10:42 AM
To: Access Developers discussion and problem solving
Subject: Re: [AccessD] Make pdf report
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
>
--
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