Solved

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

Posted on 2014-09-12
7
889 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
Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

 

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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

Access custom database properties are useful for storing miscellaneous bits of information in a format that persists through database closing and reopening.  This article shows how to create and use them.
The Windows Phone Theme Colours is a tight, powerful, and well balanced palette. This tiny Access application makes it a snap to select and pick a value. And it doubles as an intro to implementing WithEvents, one of Access' hidden gems.
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…
Both in life and business – not all partnerships are created equal. Spend 30 short minutes with us to learn:   • Key questions to ask when considering a partnership to accelerate your business into the cloud • Pitfalls and mistakes other partners…

752 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