Solved

Need help for auto update a running balance in adotable - Part III

Posted on 2014-03-19
5
248 Views
Last Modified: 2014-03-24
Part I: http://www.experts-exchange.com/Programming/Languages/Pascal/Delphi/Q_28387628.html?anchor=a39927760

Part II: http://www.experts-exchange.com/Programming/Languages/Pascal/Delphi/Q_28390885.html#a39936844

... and although it works, there is a new problem. I made an import with 500 records. So new access.accdb is only 460 kb but now running ADODataset with AutoCalcFields needs more than 14 !! seconds to update the balance.

Is there any way to speed up like an excel tabsheet?

Next 500 points from me!

Thanks,
Hair fighting Tom
0
Comment
Question by:Brainwashed2
  • 3
  • 2
5 Comments
 
LVL 26

Expert Comment

by:Sinisa Vuk
ID: 39940335
If it is no problem, can you post this database file here. (or made some test one)
Is ID and Date fields indexed? (Is ID set as primary key?)
0
 

Author Comment

by:Brainwashed2
ID: 39940942
No problem :) See randomized data in attachment.
HHB.accdb
0
 
LVL 26

Accepted Solution

by:
Sinisa Vuk earned 500 total points
ID: 39949165
As you have db under control (and this is for your own personal usage) - I suggest to add field (in example I add Balance) in which will be added real calculated balance.
I add two buttons - one for recalculate balance and one for just open table (for later usage - once you have balance). Calculating balance can be done after you enter new data - this works a little faster than using sub-select. Hope this help.
db-example.zip
0
 

Author Comment

by:Brainwashed2
ID: 39949725
Thank you for this suggestion. This way was my first strategy, but I wanted to find a solution like Excel with AutoCalcFields.

Your first idea was very good and fast enough, but there was the problem with later added entries and an "useless" new ID. Your second response has now prompted me to another approach. I give each record a unique ID, containing date and a AutoInc time.

02.01.2014 00:00:01
02.01.2014 00:00:02
02.01.2014 00:00:03
03.01.2014 00:00:01
...
15.01.2014 00:00:01
15.01.2014 00:00:02
...
17.01.2014 00:00:01

This way I can use your fast CommandText from your first answer and there is no need, to loop through (perhaps?) >500 entries only at 'refreshtime'.

For your help many thanks and I think, 500 Points are justyfied:)
0
 
LVL 26

Expert Comment

by:Sinisa Vuk
ID: 39949732
Thnx. Access databse is simple to use but not powerful ... so glad that solution comes up...
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

948 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now