Selasa, 25 Juli 2017

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

 

John and Duane,

I removed the extra lines and changed the string pdf to the acFormatPDF and it worked. Thank You So Much for your assistance. The extra lines came from the macro I converted to VBA. Not sure exactly why the extra open report lines were in there. I kept it because I thought someone put them in there for a reason.

Jim Wagner



On Mon Jul 24 2017 16:12:13 GMT-0700 (US Mountain Standard Time), Duane Hookom duanehookom@hotmail.com [MS_Access_Professionals] <MS_Access_Professionals@yahoogroups.com> wrote:


 

I would also question why multiple queries are needed. Are there different tables and calculations or simply different filtering?


Regards,

Duane Hookom

Minnesota




From: MS_Access_Professionals@yahoogroups.com <MS_Access_Professionals@yahoogroups.com> on behalf of John Viescas JohnV@msn.com [MS_Access_Professionals] <MS_Access_Professionals@yahoogroups.com>
Sent: Monday, July 24, 2017 2:44 PM
To: MS_Access_Professionals@yahoogroups.com
Subject: Re: [MS_AccessPros] Export report using a query as a filter
 


Jim-

Why are you opening the report three times?

And where is your DoCmd.OutputTo command?  And for that you need acFormatPDF, not a string with "PDFFormat(*.pdf)".

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 
http://www.viescas.com/

www.viescas.com
If you're at all interested in Microsoft Access or SQL Server, this is the place to be! Check out the book recommendations and all the cool links!


 
(Paris, France)




On Jul 24, 2017, at 7:48 PM, Jim Wagner luvmymelody@yahoo.com [MS_Access_Professionals] <MS_Access_Professionals@yahoogroups.com> wrote:



John,

I think I figured out the syntax error but now I am getting another error Compile Error: Expected: named parameter. It stops on the "PDFFormat(*.pdf)"

Jim Wagner



On Mon Jul 24 2017 10:28:30 GMT-0700 (US Mountain Standard Time), Jim Wagner luvmymelody@yahoo.com [MS_Access_Professionals] <MS_Access_Professionals@yahoogroups.com> wrote:



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 (7)

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