Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Access 2013: Use a make table query for faster report loads

Posted on 2014-09-12
7
Medium Priority
?
941 Views
Last Modified: 2014-09-18
Have a legacy database am modernizing using a web database.  In testing, the desktop reports were running slow.  But they also run slow, when the data is local.  Just running that much slower, now.

Took apart the original reports until I found the culprit.  There are three sub-reports in the main report and once I removed them, report runs like lightning.  So the root cause to speed is the sub-report design, not the new web back end.

Found that make table queries are a much faster way of presenting data in sub-reports and very true.  Now that we have this method, the question is:  How to elegantly update the new local table, when running the report?
0
Comment
Question by:VirtualKansas
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
7 Comments
 
LVL 16

Expert Comment

by:Sheils
ID: 40320122
You can use a mismatch query to append the new records and an update query to update query to add new records.
0
 

Author Comment

by:VirtualKansas
ID: 40320148
I believe every word you're saying, just need more detail.  That and how to fire the query on report load, was in question.

Short version, make table query solved the speed issue; no just need data to be current on report load.
0
 
LVL 16

Accepted Solution

by:
Sheils earned 2000 total points
ID: 40320190
I would use the following steps:-

Run the create table query when you first open the database. You can to that by using the onload even of the first form that opens when you load the database.

Then use the after update event of the form that you use to update records to run the update query
Use the after update event of the form that you use to add new records to run the append query.

The code will be something like:

Private Sub Form_AfterUpdate()

Dim strSQL as String

strSQL="your Update Query" & " where id=" & Me.YourIdfield

Currentdb.Execute strSQL


End Sub
0
Not sure which OpenStack Certification to get?

So you’ve realized you might want to get certified in OpenStack, but you’re not sure what the benefits might be or even which one you should take. You know there are several certification courses you can choose from, but how do you know which one is right for you?

 

Author Closing Comment

by:VirtualKansas
ID: 40320213
My SQL skills aren't up to yours, but I get the gist and will take the answer on faith it can be done.  

I just got zinged by another limitation in my skill set in that it appears a make table query brings additional challenges when adding another table.  This will keep me occupied for the rest of the night before I can try your suggestion.  

In the mean time, thank you for quick response...
0
 
LVL 16

Expert Comment

by:Sheils
ID: 40320234
Instead of running a make table query all the time you can create a "temporary" table (tblTemp) with all the fields you need. Then run an append query when you load the database:

  SQL will be something like:

Insert Into tblTemp Select TableA.field1,TableB.field2 ....

Clear the temporary table when you close the database by using a delete query:

SQL:- Delete * From tblTemo
0
 

Author Comment

by:VirtualKansas
ID: 40328936
Sweet!  I applied your suggestion on append vs. make table.  

Cool that all I had to do was change the existing query from make table to append and point it at the existing table.  I manually deleted the records from the made tables, ran the append query and boom, all is as expected with the reports still running super fast as was the root of the exercise (the reports were slow, as sub-reports were querying all the fields in all the records from the original tables, vs. the limited set of fields in the new made tables.)

Now just to automate the delete and the append queries and should be back on track with no re-work of the reports needed!

TY
0
 
LVL 16

Expert Comment

by:Sheils
ID: 40329813
To automatically delete all records from the temporary table you can use a form on unload event.

You can use the event from a form that is always remain open while the database is in use. Alternatively, you can create an unbounded form (frmInvisible) and set it to invisible.

You can then use the onload event of the first form that opens when you open your database to open the invisible form. Code is:

Docmd.Open "frmInvisible"

Then in the unload event of the invisible form insert this code.

Dim strSQL as string
strSQL=Delete * FROM tblTemp
Currentdb.Execute strSQL

The invisible form will remain open and unseen while the databse is in use, When you close the database the invisible will close and in the proceed fire the unload event which will delete all records from the temp table
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Traditionally, the method to display pictures in Access forms and reports is to first download them from URLs to a folder, record the path in a table and then let the form or report pull the pictures from that folder. But why not let Windows retr…
If you need a simple but flexible process for maintaining an audit trail of who created, edited, or deleted data from a table, or multiple tables, and you can do all of your work from within a form, this simple Audit Log will work for you.
This Micro Tutorial will explain how to export DynamoDB tables in Amazon Web Services.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

660 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question