Solved

Speeding up calculations on the Main Menu

Posted on 2007-04-03
6
177 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
  • 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
U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

 
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

Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

Question has a verified solution.

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

I see at least one EE question a week that pertains to using temporary tables in MS Access.  But surprisingly, I was unable to find a single article devoted solely to this topic. I don’t intend to describe all of the uses of temporary tables in t…
As tax season makes its return, so does the increase in cyber crime and tax refund phishing that comes with it
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…

860 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