?
Solved

Speeding up calculations on the Main Menu

Posted on 2007-04-03
6
Medium Priority
?
183 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
 [eBook] Windows Nano Server

Download this FREE eBook and learn all you need to get started with Windows Nano Server, including deployment options, remote management
and troubleshooting tips and tricks

 
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 2000 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

In earlier versions of Windows (XP and before), you could drag a database to the taskbar, where it would appear as a taskbar icon to open that database.  This article shows how to recreate this functionality in Windows 7 through 10.
AutoNumbers should increment automatically, without duplicates.  But sometimes something goes wrong, and the next AutoNumber value is a duplicate.  This article shows how to recover from this problem.
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.
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…
Suggested Courses

770 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