Solved

Speeding up calculations on the Main Menu

Posted on 2007-04-03
6
176 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

The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

Question has a verified solution.

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

When you are entering numbers in a speadsheet, and don't remember what 6×7 is, you just type “=6*7" instead. It works in every cell! This is not so in Access. To enter the elusive 42 in a text box, you have to find a calculator, and then copy the re…
It’s been over a month into 2017, and there is already a sophisticated Gmail phishing email making it rounds. New techniques and tactics, have given hackers a way to authentically impersonate your contacts.How it Works The attack works by targeti…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…

777 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