Senin, 30 Juni 2025

[Special] [MSAccessProfessionals] Karens's power tools- updated Print Directory

Hi all
I just got an email announcing that one of Karen's Powertools has been updated. Directory Printer Lite is now available for free at https://www.karenware.com/powertools/karens-directory-printer-lite
Check out all the other tools. They are all really handy.
--
Regards,
Bill Mosca, Founder - MS_Access_Professionals
Microsoft Office Access MVP 2010-2016
My nothing-to-do-with-Access blog
 
_._,_._,_

Groups.io Links:

You receive all messages sent to this group.

View/Reply Online (#116701) | Reply to Group | Reply to Sender | Mute This Topic | New Topic
Your Subscription | Contact Group Owner | Unsubscribe [sugeng.panjalu.access@blogger.com]

_._,_._,_

Rabu, 25 Juni 2025

Re: [MSAccessProfessionals] Saving Invoices to individual PDFs

Happy to help!

Paul

Sent via the Samsung Galaxy S25+, an AT&T 5G smartphone
Get Outlook for Android

From: MSAccessProfessionals@groups.io <MSAccessProfessionals@groups.io> on behalf of Doyce Winberry via groups.io <doyce.winberry=xpo.com@groups.io>
Sent: Wednesday, June 25, 2025 1:09:43 PM
To: MSAccessProfessionals@groups.io <MSAccessProfessionals@groups.io>
Subject: Re: [MSAccessProfessionals] Saving Invoices to individual PDFs
 

Paul,

 

You hit the nail on the head!  Thank you.  I swear I tried this but it must have been something similar and not quite right.  😊

 

Doyce Winberry

Manufacturing

Manager Systems

 

XPO

2001 Benton Street

Searcy, AR 72143 USA

O: +1 501-207-5973   M: +1 501-207-2269

 

From: MSAccessProfessionals@groups.io <MSAccessProfessionals@groups.io> On Behalf Of Paul Baldy via groups.io
Sent: Wednesday, June 25, 2025 2:27 PM
To: MSAccessProfessionals@groups.io
Subject: Re: [MSAccessProfessionals] Saving Invoices to individual PDFs

 

You would need the bang to indicate it's a value from the recordset. Presuming your debug is returning the correct value, try the same syntax: DoCmd.OpenReport sReportName, acViewPreview, , "[Invce_31]='" & rs.Fields("INVCE_31") & "'"

ZjQcmQRYFpfptBannerStart

This Message Is From an Untrusted Sender

You have not previously corresponded with this sender.

ZjQcmQRYFpfptBannerEnd

You would need the bang to indicate it's a value from the recordset.  Presuming your debug is returning the correct value, try the same syntax:

 

DoCmd.OpenReport sReportName, acViewPreview, , "[Invce_31]='" & rs.Fields("INVCE_31") & "'"

 

Paul

------ Original Message ------

From: "Doyce Winberry via groups.io" <doyce.winberry=xpo.com@groups.io>

Sent: 6/25/2025 12:13:05 PM

Subject: Re: [MSAccessProfessionals] Saving Invoices to individual PDFs

 

Hi Paul,

 

I've added the delimiters like this:

DoCmd.OpenReport sReportName, acViewPreview, , "[Invce_31]='" & [INVCE_31] & "'", acHidden

 

I'm getting runtime error 13 Type Mismatch.

 

Doyce Winberry

Manufacturing

Manager Systems

 

XPO

2001 Benton Street

Searcy, AR 72143 USA

O: +1 501-207-5973   M: +1 501-207-2269

 

From: MSAccessProfessionals@groups.io <MSAccessProfessionals@groups.io> On Behalf Of Paul Baldy via groups.io
Sent: Wednesday, June 25, 2025 2:08 PM
To: MSAccessProfessionals@groups.io
Subject: Re: [MSAccessProfessionals] Saving Invoices to individual PDFs

 

You haven't mentioned the error you get. Since the field is text, you'd need the delimiters: https://www.baldyweb.com/wherecondition.htm Paul ------ Original Message ------ From: "Doyce Winberry via groups.io" <doyce.winberry=xpo.com@groups.io>

ZjQcmQRYFpfptBannerStart

This Message Is From an Untrusted Sender

You have not previously corresponded with this sender.

ZjQcmQRYFpfptBannerEnd

You haven't mentioned the error you get.  Since the field is text, you'd need the delimiters:

 

 

Paul

 

------ Original Message ------

From: "Doyce Winberry via groups.io" <doyce.winberry=xpo.com@groups.io>

Sent: 6/25/2025 11:12:10 AM

Subject: [MSAccessProfessionals] Saving Invoices to individual PDFs

 

Hello Friends,

 

I'm trying to save an invoice report as individual invoices, then I want to email them out. First the saving part.  I found a code sample that I am modifying but I'm hung up on filtering the report.  Its criteria is that it has N in the print flag.  If I just open the report, it runs fine.  In the VBA, I want to save a copy of each invoice as a separate PDF and name it with the invoice number.  The code is hanging when I try to filter the report with this line: DoCmd.OpenReport sReportName, acViewPreview, , "[Invce_31]=" & ![INVCE_31], acHidden.  Invce_31 is the invoice number, but it is a string. I've tried all kinds of qualifiers '" & Invce_31 & "'" but it always errors out.  I've also tried DoCmd.OpenReport "MaxInvoiceNoPrint", acViewPreview, , "[Invce_31]='" & 00197273 & "'" in the immediate window where 00197273 is a legitimate invoice and the report opens but there is no data. Below is the whole procedure:

 

Public Sub ExportInvoices()

    Dim rs                    As DAO.Recordset

    Dim sFolder               As String

    Dim sFile                 As String

    Const sReportName = "MaxInvoiceNoPrint"

 

    'On Error GoTo Error_Handler

 

    'The folder in which to save the PDFs

        sFolder = \\ltpfp7460.amer.corp.xpo.com\Accounting\Accts Receivable\invoice copies & "\"

        'Debug.Print sFolder

 

    'Define the Records that you will use to filtered the report with

    Set rs = CurrentDb.OpenRecordset("SELECT INVCE_31 FROM qryMaxInvoiceNoPrint;", dbOpenSnapshot)

    With rs

        If .RecordCount <> 0 Then 'Make sure we have record to generate PDF with

            .MoveFirst

            Do While Not .EOF

            Debug.Print rs.Fields("INVCE_31")

                'Build the PDF filename we are going to use to save the PDF with

                sFile = sFolder & Nz(![INVCE_31], "") & ".pdf"

                'Open the report filtered to the specific record or criteria we want in hidden mode

                DoCmd.OpenReport sReportName, acViewPreview, , "[Invce_31]=" & ![INVCE_31], acHidden

                'Print it out as a PDF

                DoCmd.OutputTo acOutputReport, sReportName, acFormatPDF, sFile, , , , acExportQualityPrint

                'Close the report now that we're done with this criteria

                DoCmd.Close acReport, sReportName

                'If you wanted to create an e-mail and include an individual report, you would do so now

                .MoveNext

            Loop

        End If

    End With

 

    'Open the folder housing the PDF files (Optional)

    Application.FollowHyperlink sFolder

    MsgBox "Report pages exported as individual PDFs."

 

End Sub

 

Any help figuring this out is greatly appreciated. 

 

Doyce Winberry

Manufacturing

Manager Systems

 

XPO

2001 Benton Street

Searcy, AR 72143 USA

O: +1 501-207-5973   M: +1 501-207-2269

 

Re: [MSAccessProfessionals] Saving Invoices to individual PDFs

Paul,

 

You hit the nail on the head!  Thank you.  I swear I tried this but it must have been something similar and not quite right.  😊

 

Doyce Winberry

Manufacturing

Manager Systems

 

XPO

2001 Benton Street

Searcy, AR 72143 USA

O: +1 501-207-5973   M: +1 501-207-2269

 

From: MSAccessProfessionals@groups.io <MSAccessProfessionals@groups.io> On Behalf Of Paul Baldy via groups.io
Sent: Wednesday, June 25, 2025 2:27 PM
To: MSAccessProfessionals@groups.io
Subject: Re: [MSAccessProfessionals] Saving Invoices to individual PDFs

 

You would need the bang to indicate it's a value from the recordset. Presuming your debug is returning the correct value, try the same syntax: DoCmd.OpenReport sReportName, acViewPreview, , "[Invce_31]='" & rs.Fields("INVCE_31") & "'"

ZjQcmQRYFpfptBannerStart

This Message Is From an Untrusted Sender

You have not previously corresponded with this sender.

ZjQcmQRYFpfptBannerEnd

You would need the bang to indicate it's a value from the recordset.  Presuming your debug is returning the correct value, try the same syntax:

 

DoCmd.OpenReport sReportName, acViewPreview, , "[Invce_31]='" & rs.Fields("INVCE_31") & "'"

 

Paul

------ Original Message ------

From: "Doyce Winberry via groups.io" <doyce.winberry=xpo.com@groups.io>

Sent: 6/25/2025 12:13:05 PM

Subject: Re: [MSAccessProfessionals] Saving Invoices to individual PDFs

 

Hi Paul,

 

I've added the delimiters like this:

DoCmd.OpenReport sReportName, acViewPreview, , "[Invce_31]='" & [INVCE_31] & "'", acHidden

 

I'm getting runtime error 13 Type Mismatch.

 

Doyce Winberry

Manufacturing

Manager Systems

 

XPO

2001 Benton Street

Searcy, AR 72143 USA

O: +1 501-207-5973   M: +1 501-207-2269

 

From: MSAccessProfessionals@groups.io <MSAccessProfessionals@groups.io> On Behalf Of Paul Baldy via groups.io
Sent: Wednesday, June 25, 2025 2:08 PM
To: MSAccessProfessionals@groups.io
Subject: Re: [MSAccessProfessionals] Saving Invoices to individual PDFs

 

You haven't mentioned the error you get. Since the field is text, you'd need the delimiters: https://www.baldyweb.com/wherecondition.htm Paul ------ Original Message ------ From: "Doyce Winberry via groups.io" <doyce.winberry=xpo.com@groups.io>

ZjQcmQRYFpfptBannerStart

This Message Is From an Untrusted Sender

You have not previously corresponded with this sender.

ZjQcmQRYFpfptBannerEnd

You haven't mentioned the error you get.  Since the field is text, you'd need the delimiters:

 

 

Paul

 

------ Original Message ------

From: "Doyce Winberry via groups.io" <doyce.winberry=xpo.com@groups.io>

Sent: 6/25/2025 11:12:10 AM

Subject: [MSAccessProfessionals] Saving Invoices to individual PDFs

 

Hello Friends,

 

I'm trying to save an invoice report as individual invoices, then I want to email them out. First the saving part.  I found a code sample that I am modifying but I'm hung up on filtering the report.  Its criteria is that it has N in the print flag.  If I just open the report, it runs fine.  In the VBA, I want to save a copy of each invoice as a separate PDF and name it with the invoice number.  The code is hanging when I try to filter the report with this line: DoCmd.OpenReport sReportName, acViewPreview, , "[Invce_31]=" & ![INVCE_31], acHidden.  Invce_31 is the invoice number, but it is a string. I've tried all kinds of qualifiers '" & Invce_31 & "'" but it always errors out.  I've also tried DoCmd.OpenReport "MaxInvoiceNoPrint", acViewPreview, , "[Invce_31]='" & 00197273 & "'" in the immediate window where 00197273 is a legitimate invoice and the report opens but there is no data. Below is the whole procedure:

 

Public Sub ExportInvoices()

    Dim rs                    As DAO.Recordset

    Dim sFolder               As String

    Dim sFile                 As String

    Const sReportName = "MaxInvoiceNoPrint"

 

    'On Error GoTo Error_Handler

 

    'The folder in which to save the PDFs

        sFolder = \\ltpfp7460.amer.corp.xpo.com\Accounting\Accts Receivable\invoice copies & "\"

        'Debug.Print sFolder

 

    'Define the Records that you will use to filtered the report with

    Set rs = CurrentDb.OpenRecordset("SELECT INVCE_31 FROM qryMaxInvoiceNoPrint;", dbOpenSnapshot)

    With rs

        If .RecordCount <> 0 Then 'Make sure we have record to generate PDF with

            .MoveFirst

            Do While Not .EOF

            Debug.Print rs.Fields("INVCE_31")

                'Build the PDF filename we are going to use to save the PDF with

                sFile = sFolder & Nz(![INVCE_31], "") & ".pdf"

                'Open the report filtered to the specific record or criteria we want in hidden mode

                DoCmd.OpenReport sReportName, acViewPreview, , "[Invce_31]=" & ![INVCE_31], acHidden

                'Print it out as a PDF

                DoCmd.OutputTo acOutputReport, sReportName, acFormatPDF, sFile, , , , acExportQualityPrint

                'Close the report now that we're done with this criteria

                DoCmd.Close acReport, sReportName

                'If you wanted to create an e-mail and include an individual report, you would do so now

                .MoveNext

            Loop

        End If

    End With

 

    'Open the folder housing the PDF files (Optional)

    Application.FollowHyperlink sFolder

    MsgBox "Report pages exported as individual PDFs."

 

End Sub

 

Any help figuring this out is greatly appreciated. 

 

Doyce Winberry

Manufacturing

Manager Systems

 

XPO

2001 Benton Street

Searcy, AR 72143 USA

O: +1 501-207-5973   M: +1 501-207-2269

 

Re: [MSAccessProfessionals] Saving Invoices to individual PDFs

You would need the bang to indicate it's a value from the recordset.  Presuming your debug is returning the correct value, try the same syntax:

DoCmd.OpenReport sReportName, acViewPreview, , "[Invce_31]='" & rs.Fields("INVCE_31") & "'"

Paul
------ Original Message ------
From: "Doyce Winberry via groups.io" <doyce.winberry=xpo.com@groups.io>
Sent: 6/25/2025 12:13:05 PM
Subject: Re: [MSAccessProfessionals] Saving Invoices to individual PDFs

Hi Paul,

 

I've added the delimiters like this:

DoCmd.OpenReport sReportName, acViewPreview, , "[Invce_31]='" & [INVCE_31] & "'", acHidden

 

I'm getting runtime error 13 Type Mismatch.

 

Doyce Winberry

Manufacturing

Manager Systems

 

XPO

2001 Benton Street

Searcy, AR 72143 USA

O: +1 501-207-5973   M: +1 501-207-2269

 

From: MSAccessProfessionals@groups.io <MSAccessProfessionals@groups.io> On Behalf Of Paul Baldy via groups.io
Sent: Wednesday, June 25, 2025 2:08 PM
To: MSAccessProfessionals@groups.io
Subject: Re: [MSAccessProfessionals] Saving Invoices to individual PDFs

 

You haven't mentioned the error you get. Since the field is text, you'd need the delimiters: https://www.baldyweb.com/wherecondition.htm Paul ------ Original Message ------ From: "Doyce Winberry via groups.io" <doyce.winberry=xpo.com@groups.io>

ZjQcmQRYFpfptBannerStart

This Message Is From an Untrusted Sender

You have not previously corresponded with this sender.

ZjQcmQRYFpfptBannerEnd

You haven't mentioned the error you get.  Since the field is text, you'd need the delimiters:

 

 

Paul

 

------ Original Message ------

From: "Doyce Winberry via groups.io" <doyce.winberry=xpo.com@groups.io>

Sent: 6/25/2025 11:12:10 AM

Subject: [MSAccessProfessionals] Saving Invoices to individual PDFs

 

Hello Friends,

 

I'm trying to save an invoice report as individual invoices, then I want to email them out. First the saving part.  I found a code sample that I am modifying but I'm hung up on filtering the report.  Its criteria is that it has N in the print flag.  If I just open the report, it runs fine.  In the VBA, I want to save a copy of each invoice as a separate PDF and name it with the invoice number.  The code is hanging when I try to filter the report with this line: DoCmd.OpenReport sReportName, acViewPreview, , "[Invce_31]=" & ![INVCE_31], acHidden.  Invce_31 is the invoice number, but it is a string. I've tried all kinds of qualifiers '" & Invce_31 & "'" but it always errors out.  I've also tried DoCmd.OpenReport "MaxInvoiceNoPrint", acViewPreview, , "[Invce_31]='" & 00197273 & "'" in the immediate window where 00197273 is a legitimate invoice and the report opens but there is no data. Below is the whole procedure:

 

Public Sub ExportInvoices()

    Dim rs                    As DAO.Recordset

    Dim sFolder               As String

    Dim sFile                 As String

    Const sReportName = "MaxInvoiceNoPrint"

 

    'On Error GoTo Error_Handler

 

    'The folder in which to save the PDFs

        sFolder = \\ltpfp7460.amer.corp.xpo.com\Accounting\Accts Receivable\invoice copies & "\"

        'Debug.Print sFolder

 

    'Define the Records that you will use to filtered the report with

    Set rs = CurrentDb.OpenRecordset("SELECT INVCE_31 FROM qryMaxInvoiceNoPrint;", dbOpenSnapshot)

    With rs

        If .RecordCount <> 0 Then 'Make sure we have record to generate PDF with

            .MoveFirst

            Do While Not .EOF

            Debug.Print rs.Fields("INVCE_31")

                'Build the PDF filename we are going to use to save the PDF with

                sFile = sFolder & Nz(![INVCE_31], "") & ".pdf"

                'Open the report filtered to the specific record or criteria we want in hidden mode

                DoCmd.OpenReport sReportName, acViewPreview, , "[Invce_31]=" & ![INVCE_31], acHidden

                'Print it out as a PDF

                DoCmd.OutputTo acOutputReport, sReportName, acFormatPDF, sFile, , , , acExportQualityPrint

                'Close the report now that we're done with this criteria

                DoCmd.Close acReport, sReportName

                'If you wanted to create an e-mail and include an individual report, you would do so now

                .MoveNext

            Loop

        End If

    End With

 

    'Open the folder housing the PDF files (Optional)

    Application.FollowHyperlink sFolder

    MsgBox "Report pages exported as individual PDFs."

 

End Sub

 

Any help figuring this out is greatly appreciated. 

 

Doyce Winberry

Manufacturing

Manager Systems

 

XPO

2001 Benton Street

Searcy, AR 72143 USA

O: +1 501-207-5973   M: +1 501-207-2269

 

Re: [MSAccessProfessionals] Saving Invoices to individual PDFs

Hi Paul,

 

I've added the delimiters like this:

DoCmd.OpenReport sReportName, acViewPreview, , "[Invce_31]='" & [INVCE_31] & "'", acHidden

 

I'm getting runtime error 13 Type Mismatch.

 

Doyce Winberry

Manufacturing

Manager Systems

 

XPO

2001 Benton Street

Searcy, AR 72143 USA

O: +1 501-207-5973   M: +1 501-207-2269

 

From: MSAccessProfessionals@groups.io <MSAccessProfessionals@groups.io> On Behalf Of Paul Baldy via groups.io
Sent: Wednesday, June 25, 2025 2:08 PM
To: MSAccessProfessionals@groups.io
Subject: Re: [MSAccessProfessionals] Saving Invoices to individual PDFs

 

You haven't mentioned the error you get. Since the field is text, you'd need the delimiters: https://www.baldyweb.com/wherecondition.htm Paul ------ Original Message ------ From: "Doyce Winberry via groups.io" <doyce.winberry=xpo.com@groups.io>

ZjQcmQRYFpfptBannerStart

This Message Is From an Untrusted Sender

You have not previously corresponded with this sender.

ZjQcmQRYFpfptBannerEnd

You haven't mentioned the error you get.  Since the field is text, you'd need the delimiters:

 

 

Paul

 

------ Original Message ------

From: "Doyce Winberry via groups.io" <doyce.winberry=xpo.com@groups.io>

Sent: 6/25/2025 11:12:10 AM

Subject: [MSAccessProfessionals] Saving Invoices to individual PDFs

 

Hello Friends,

 

I'm trying to save an invoice report as individual invoices, then I want to email them out. First the saving part.  I found a code sample that I am modifying but I'm hung up on filtering the report.  Its criteria is that it has N in the print flag.  If I just open the report, it runs fine.  In the VBA, I want to save a copy of each invoice as a separate PDF and name it with the invoice number.  The code is hanging when I try to filter the report with this line: DoCmd.OpenReport sReportName, acViewPreview, , "[Invce_31]=" & ![INVCE_31], acHidden.  Invce_31 is the invoice number, but it is a string. I've tried all kinds of qualifiers '" & Invce_31 & "'" but it always errors out.  I've also tried DoCmd.OpenReport "MaxInvoiceNoPrint", acViewPreview, , "[Invce_31]='" & 00197273 & "'" in the immediate window where 00197273 is a legitimate invoice and the report opens but there is no data. Below is the whole procedure:

 

Public Sub ExportInvoices()

    Dim rs                    As DAO.Recordset

    Dim sFolder               As String

    Dim sFile                 As String

    Const sReportName = "MaxInvoiceNoPrint"

 

    'On Error GoTo Error_Handler

 

    'The folder in which to save the PDFs

        sFolder = \\ltpfp7460.amer.corp.xpo.com\Accounting\Accts Receivable\invoice copies & "\"

        'Debug.Print sFolder

 

    'Define the Records that you will use to filtered the report with

    Set rs = CurrentDb.OpenRecordset("SELECT INVCE_31 FROM qryMaxInvoiceNoPrint;", dbOpenSnapshot)

    With rs

        If .RecordCount <> 0 Then 'Make sure we have record to generate PDF with

            .MoveFirst

            Do While Not .EOF

            Debug.Print rs.Fields("INVCE_31")

                'Build the PDF filename we are going to use to save the PDF with

                sFile = sFolder & Nz(![INVCE_31], "") & ".pdf"

                'Open the report filtered to the specific record or criteria we want in hidden mode

                DoCmd.OpenReport sReportName, acViewPreview, , "[Invce_31]=" & ![INVCE_31], acHidden

                'Print it out as a PDF

                DoCmd.OutputTo acOutputReport, sReportName, acFormatPDF, sFile, , , , acExportQualityPrint

                'Close the report now that we're done with this criteria

                DoCmd.Close acReport, sReportName

                'If you wanted to create an e-mail and include an individual report, you would do so now

                .MoveNext

            Loop

        End If

    End With

 

    'Open the folder housing the PDF files (Optional)

    Application.FollowHyperlink sFolder

    MsgBox "Report pages exported as individual PDFs."

 

End Sub

 

Any help figuring this out is greatly appreciated. 

 

Doyce Winberry

Manufacturing

Manager Systems

 

XPO

2001 Benton Street

Searcy, AR 72143 USA

O: +1 501-207-5973   M: +1 501-207-2269

 

Re: [MSAccessProfessionals] Saving Invoices to individual PDFs

Well Hello Bill Mosca!

 

It's great to hear from you.  It's been quite a while. I hope you are well.  I agree AD was a genius!  I'll check it out.

 

Doyce Winberry

Manufacturing

Manager Systems

 

XPO

2001 Benton Street

Searcy, AR 72143 USA

O: +1 501-207-5973   M: +1 501-207-2269

 

From: MSAccessProfessionals@groups.io <MSAccessProfessionals@groups.io> On Behalf Of Bill Mosca via groups.io
Sent: Wednesday, June 25, 2025 2:02 PM
To: MSAccessProfessionals@groups.io
Subject: Re: [MSAccessProfessionals] Saving Invoices to individual PDFs

 

Hi Doyce I've been away from Access for a few years now, but I remember vaguely that I approached multiple invoices on one report with each invoice being a subreport. You might find something you can use at http://www.rogersaccesslibrary.com/forum/tejpal-a-d_forum45.html

ZjQcmQRYFpfptBannerStart

This Message Is From an Untrusted Sender

You have not previously corresponded with this sender.

ZjQcmQRYFpfptBannerEnd

Hi Doyce

 

I've been away from Access for a few years now, but I remember vaguely that I approached multiple invoices on one report with each invoice being a subreport. You might find something you can use at http://www.rogersaccesslibrary.com/forum/tejpal-a-d_forum45.html

 

AD was a blooming genius when it came to finding solutions with anything that had to do with reports.

 

Regards,

Bill Mosca

 

 

From: MSAccessProfessionals@groups.io <MSAccessProfessionals@groups.io> On Behalf Of Doyce Winberry via groups.io
Sent: Wednesday, June 25, 2025 11:12 AM
To: msaccessprofessionals@groups.io
Subject: [MSAccessProfessionals] Saving Invoices to individual PDFs

 

Hello Friends,

 

I'm trying to save an invoice report as individual invoices, then I want to email them out. First the saving part.  I found a code sample that I am modifying but I'm hung up on filtering the report.  Its criteria is that it has N in the print flag.  If I just open the report, it runs fine.  In the VBA, I want to save a copy of each invoice as a separate PDF and name it with the invoice number.  The code is hanging when I try to filter the report with this line: DoCmd.OpenReport sReportName, acViewPreview, , "[Invce_31]=" & ![INVCE_31], acHidden.  Invce_31 is the invoice number, but it is a string. I've tried all kinds of qualifiers '" & Invce_31 & "'" but it always errors out.  I've also tried DoCmd.OpenReport "MaxInvoiceNoPrint", acViewPreview, , "[Invce_31]='" & 00197273 & "'" in the immediate window where 00197273 is a legitimate invoice and the report opens but there is no data. Below is the whole procedure:

 

Public Sub ExportInvoices()

    Dim rs                    As DAO.Recordset

    Dim sFolder               As String

    Dim sFile                 As String

    Const sReportName = "MaxInvoiceNoPrint"

 

    'On Error GoTo Error_Handler

 

    'The folder in which to save the PDFs

        sFolder = \\ltpfp7460.amer.corp.xpo.com\Accounting\Accts Receivable\invoice copies & "\"

        'Debug.Print sFolder

 

    'Define the Records that you will use to filtered the report with

    Set rs = CurrentDb.OpenRecordset("SELECT INVCE_31 FROM qryMaxInvoiceNoPrint;", dbOpenSnapshot)

    With rs

        If .RecordCount <> 0 Then 'Make sure we have record to generate PDF with

            .MoveFirst

            Do While Not .EOF

            Debug.Print rs.Fields("INVCE_31")

                'Build the PDF filename we are going to use to save the PDF with

                sFile = sFolder & Nz(![INVCE_31], "") & ".pdf"

                'Open the report filtered to the specific record or criteria we want in hidden mode

                DoCmd.OpenReport sReportName, acViewPreview, , "[Invce_31]=" & ![INVCE_31], acHidden

                'Print it out as a PDF

                DoCmd.OutputTo acOutputReport, sReportName, acFormatPDF, sFile, , , , acExportQualityPrint

                'Close the report now that we're done with this criteria

                DoCmd.Close acReport, sReportName

                'If you wanted to create an e-mail and include an individual report, you would do so now

                .MoveNext

            Loop

        End If

    End With

 

    'Open the folder housing the PDF files (Optional)

    Application.FollowHyperlink sFolder

    MsgBox "Report pages exported as individual PDFs."

 

End Sub

 

Any help figuring this out is greatly appreciated. 

 

Doyce Winberry

Manufacturing

Manager Systems

 

XPO

2001 Benton Street

Searcy, AR 72143 USA

O: +1 501-207-5973   M: +1 501-207-2269