Solved

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

Posted on 2014-03-19
5
258 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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Intraweb download file link ? 1 156
how to send memory stream from ics Client To ics server ? 11 138
Delphi Yen format 3 45
FMX TEdit KeyUp handler detecting  "enter" key 4 14
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…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…

830 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