Senin, 24 Juli 2017

Re: [MS_AccessPros] Export report using a query as a filter

 

John,

I am getting the syntax error again. below is what I have

Private Sub cmdEmailNonExemptTimesheetsForPoly_Click()

    On Error GoTo cmdEmailNonExemptTimesheetsForPoly_Err

    DoCmd.SetWarnings False
    DoCmd.OpenReport "rptNonExemptTimesheets", acViewReport, , OpenArgs:="qryNonExemptTimesheetsForPoly"    ' Source:
   
    DoCmd.OpenReport "rptNonExemptTimesheets", acViewPreview, , OpenArgs:="qryNonExemptTimesheetsForPoly"  ' Source:
 
   
    DoCmd.OpenReport "rptNonExemptTimesheets", acViewPreview, OpenArgs:="qryNonExemptTimesheetsForPoly", "PDFFormat(*.pdf)", "\\Afwfs\AF\Services\UnivSrv\Admin Services\Management Support Services\ADMINISTRATIVE SERVICES DATABASES\MANAGEMENT SUPPORT SERVICES T-A-P\ABSENCE DATABASE\Department Reports\PolyTimesheets.pdf", False, "", 0, acExportQualityPrint"
   
   
   
   
    SendAnEmailPolyTimesheets

. . . . . . . . . etc



Jim Wagner



On Mon Jul 24 2017 09:49:33 GMT-0700 (US Mountain Standard Time), John Viescas JohnV@msn.com [MS_Access_Professionals] <MS_Access_Professionals@yahoogroups.com> wrote:


 

Jim-


Looks like you've got a quote delimiter problem.  Try this:

       DoCmd.OpenReport "rptNonExemptTimesheets", acViewPreview, OpenArgs:="qryNonExemptTimesheetsForPoly"

And the rest needs some sort of export command??

, "PDFFormat(*.pdf)", "\\Afwfs\AF\Services\UnivSrv\Admin Services\Management Support Services\ADMINISTRATIVE SERVICES DATABASES\MANAGEMENT SUPPORT SERVICES T-A-P\ABSENCE DATABASE\Department Reports\PolyTimesheets.pdf", False, "", 0, acExportQualityPrint"

When you want to export a filtered report, you first have to open it in Print Preview, then export the report - which will use the open and filtered copy - the close the report.

John Viescas, Author
Effective SQL
SQL Queries for Mere Mortals 
Microsoft Access 2010 Inside Out
Microsoft Access 2007 Inside Out
Microsoft Access 2003 Inside Out
Building Microsoft Access Applications 
(Paris, France)




On Jul 24, 2017, at 6:28 PM, luvmymelody@yahoo.com [MS_Access_Professionals] <MS_Access_Professionals@yahoogroups.com> wrote:




Hello all,


I have several macros that I would like to convert to VBA. 

But I also am converting 4 reports to using one report and 4 different query sources. The report is a timesheet with a lot of lines and objects and controls on the report. If something changes, I have to do the same change on 4 different reports. So converting to one report and opening the report with a query filter makes more sense. 

The issue I am having is the exporting the report to a folder using the query as a filter. 


the open args are for the on open event to change the record source. 


I converted the macro that exports the reports to a folder but there is no where to use the query to filter the report before exporting it. 


I have the following to open the report

DoCmd.OpenReport "rptNonExemptTimesheets", acViewPreview, , OpenArgs:="qryNonExemptTimesheetsForPoly"


For exporting I have the following that gives me an error of Compile error:; Syntax error


       DoCmd.OpenReport "rptNonExemptTimesheets", acViewPreview, OpenArgs:="qryNonExemptTimesheetsForPoly, "PDFFormat(*.pdf)", "\\Afwfs\AF\Services\UnivSrv\Admin Services\Management Support Services\ADMINISTRATIVE SERVICES DATABASES\MANAGEMENT SUPPORT SERVICES T-A-P\ABSENCE DATABASE\Department Reports\PolyTimesheets.pdf", False, "", 0, acExportQualityPrint"



Thank You for any assistance

Jim Wagner




__._,_.___

Posted by: Jim Wagner <luvmymelody@yahoo.com>
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (3)

Have you tried the highest rated email app?
With 4.5 stars in iTunes, the Yahoo Mail app is the highest rated email app on the market. What are you waiting for? Now you can access all your inboxes (Gmail, Outlook, AOL and more) in one place. Never delete an email again with 1000GB of free cloud storage.


.

__,_._,___

Tidak ada komentar:

Posting Komentar