Solved

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

Posted on 2014-09-12
7
913 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 500 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
Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

 

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

Put Machine Learning to Work--Protect Your Clients

Machine learning means Smarter Cybersecurity™ Solutions.
As technology continues to advance, managing and analyzing massive data sets just can’t be accomplished by humans alone. It requires huge amounts of memory and storage, as well as high-speed processing of the cloud.

Question has a verified solution.

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

You deserve ‘straight talk’ from your cloud provider about your risk, your costs, security, uptime and the processes that are in place to protect your mission-critical applications.
This article shows how to get a list of available printers for display in a drop-down list, and then to use the selected printer to print an Access report or a Word document filled with Access data, using different syntax as needed for working with …
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.
This Micro Tutorial will explain how to export DynamoDB tables in Amazon Web Services.

635 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