Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8555301
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T15:05:36+00:00 2026-06-11T15:05:36+00:00

I have two functions that will open and save two diffrent reports based on

  • 0

I have two functions that will open and save two diffrent reports based on the same criteria. They are identical except for the refrences:

Function Export_MLR()
On Error GoTo Export_MLR_Err

Dim strReportName As String

DoCmd.OpenReport "Market Rate Notification Final", acViewPreview
strReportName = "S:\National Installations\Market Labor Rates\MLR_INV\MLR\" & Format    (Reports![Market Rate Notification Final].Market_ID, "00") & " " & Replace(Reports![Market  Rate Notification Final].Product_Code, " / ", "_") & "-" & "Market Rate Notification Final" & "_" & Format(Date, "mmddyy") & ".pdf"

DoCmd.OutputTo acOutputReport, "Market Rate Notification Final", "PDFFormat(*.pdf)", strReportName, False, , , acExportQualityScreen
DoCmd.Close acReport, "Market Rate Notification Final", acSaveNo

Export_MLR_Exit:
Exit Function

Export_MLR_Err:
MsgBox Error$
Resume Export_MLR_Exit


End Function

Then I created this function to select the data and put it into the table that the reports refrence line by line:

Function MassMarket()
On Error GoTo MassMarket_ERR

Dim db As DAO.Database
Dim rs1 As DAO.Recordset
Dim rs2 As DAO.Recordset


'this query creates my rs1 recordset'
DoCmd.SetWarnings (warningsOff)
DoCmd.OpenQuery "mass_market", acNormal, acEdit
DoCmd.SetWarnings (warningsOn)



Set db = CurrentDb()
Set rs1 = db.OpenRecordset("Mass_market_Rate_change")
Set rs2 = db.OpenRecordset("tbl_Form_Auto")


'this checks and clears any records in rs2' 
If rs2.EOF = False And rs2.BOF = False Then
rs2.MoveFirst
rs2.Delete
End If
rs1.MoveFirst



'loop goes through and adds 1 line runs reports saves them and deletes line'
 Do Until rs1.EOF


    Set rs2 = db.OpenRecordset("tbl_Form_Auto")
        rs2.AddNew
        rs2![MarketID] = rs1![MarketID]
        rs2![Product_ID] = rs1![Product_ID]
       rs2.Update
    Call Export_Invoice
    Call Export_MLR

    rs1.MoveNext
    rs2.MoveFirst
    rs2.Delete

 Loop

MassMarket_Exit:
Exit Function

MassMarket_ERR:
MsgBox Error$
Resume MassMarket_Exit

End Function

Now all of this worked like a charm but it created, on average 16 .pdf files per minute and I had to create 820 .pdf files(about 50 minutes). If this is the best I can do then I will take it but would love to cut this time in half if possible. Thanks for any and all input. NR

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T15:05:37+00:00Added an answer on June 11, 2026 at 3:05 pm

    In a comment you indicated the bulk of the time is spent in your functions which export the reports to PDF. I’m uncertain whether we can speed those up.

    It seems you open a report, reference a value in that report for use as part of the PDF file name, then call the OutputTo method with the same report name to save it as PDF.

    In that situation, I’m uncertain what happens “under the hood” … whether Access opens a second instance of the report object, or is smart enough to see that you already have an instance open and just use that one instead.

    As a test, try to signal Access to use the first report instance. From the online help for the ObjectName parameter of the OutputTo method:

    If you want to output the active object, specify the object’s type for the ObjectType argument and leave this argument blank.

    So what I’m suggesting is try this in your code:

    DoCmd.OutputTo acOutputReport, , "PDFFormat(*.pdf)", _
        strReportName, False, , , acExportQualityScreen
    

    If Access complains, try it with an empty string for the ObjectName parameter.

    DoCmd.OutputTo acOutputReport, "", "PDFFormat(*.pdf)", _
        strReportName, False, , , acExportQualityScreen
    

    I don’t know how much (or even if) this suggestion will speed up your code. But if you can’t speed up those export functions somehow, my hunch is your hope to cut the overall time by half is a shaky proposition.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two functions that have different enough logic but pretty much the same
So I have two jquery functions that bassically do the same, but on 2
I have two functions that return simple strings. Both are registered. $.views.helpers({ parseDate: function
I have two functions that caluclate and adjust the height and width of elements
I have two functions that are supposed to encrypt and decrypt a string but
Say I have two functions that expect ...rest parameters private function a(...myParams):void { trace(myParams.length);
I have created two functions that sum and subtract the numeric values of two
I have 2 classes that have exact two functions. The difference between them is
I have two fields that I'd like to match. (already done the validation functions
My boss has asked for a page that will not change to have two

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.