Solved

Speeding up calculations on the Main Menu

Posted on 2007-04-03
6
181 Views
Last Modified: 2012-05-05
I have an Access database, that goes straight into a Main Menu when it is opened.  On the Main Menu there are buttons that display information such as how many call backs are outstanding, how many companies are in the database etc, etc.  In total there is room for up to 20 calculations.

Over the years, I have played about with various methods for calculating this information as quickly as possibe.  I used to simply use the Dcount function on the main table, but this was always slow - especially if several people were logging in at the same time.  I found that a quicker way was to create a make table query, that copied the main table to the local front-end (the back-end is on the server).  Although this works fine, the database gets bloated.  The local data is always removed upon exit and the front-end is compressed and re-compacted - but the downside of this is fragmentation will still occur on the hard drive.

After all that - my question is this.  Does anybody know of a faster way to make these calculations without the, "make table query" (the indexes are spot on, and transferring to SQL is not an option for this project)?

All the best and thanks for your help
0
Comment
Question by:Andy Brown
[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
  • 3
  • 2
6 Comments
 
LVL 26

Expert Comment

by:jerryb30
ID: 18844715
Are all of the calculations done on a single table?
Can you post sample of SQL you used for calculations?
0
 

Author Comment

by:Andy Brown
ID: 18844738
Thanks for your help.  

Yes - all from one table.

The make table query contains only the fields that I will perform calculations on.  Once created I will then run a Dcount on the specified criteria.  For example, I have a field called ActionDate, which is updated when a call back is logged by an operator.

Here is an example of the code I would use:

me.TBCallBacks = Dcount("*","tmpCalculations","ActionDate <= Date()")
0
 
LVL 39

Expert Comment

by:stevbe
ID: 18844782
for the simplest of examples using a saved query with SQL of:
SELECT Count(*) AS MyCount FROM tblPO;

and then grabbing the value from a recordset of that query will be faster than a DCount (DCount has gotten faster over the years, especially if you use
DCount("*", "tblPO")

Me.txtCount = CurrentDB.OpenRecordset("qselCount").Collect(0)

0
Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

 
LVL 39

Expert Comment

by:stevbe
ID: 18844796
a saved query will execute faster than any Dxxx function because it will be optimized by the query execution engine to take advantage of index.
0
 

Author Comment

by:Andy Brown
ID: 18844825
Hi,
That's quite interesting, the only issue is that the query may need to be changed by the users.  For example, they may decide that they wish to count all of the records with X in a field.  They are also all using MDE front-ends - could I still use this solution.  And finally, I have experienced issues in the past when two users log in at the same time and get a locked message.

0
 
LVL 39

Accepted Solution

by:
stevbe earned 500 total points
ID: 18844933
<the query may need to be changed by the users>
How do you get their criteria now? How many criteria sets can they enter at the same time?

You could change the line a little to open a snapshot recordset which *should* process slightly faster. Any time you are doing an aggregate SQL Access will toss a quick lock to make sure it can return accurate results but that should be really quick.

CurrentDB.OpenRecordset("qselCount", dbOpenSnapshot).Collect(0)




0

Featured Post

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.

Question has a verified solution.

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

This article describes a method of delivering Word templates for use in merging Access data to Word documents, that requires no computer knowledge on the part of the recipient -- the templates are saved in table fields, and are extracted and install…
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…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.

729 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