Solved

TAdoQuery Not Updating All Records at runtime

Posted on 2003-10-21
6
157 Views
Last Modified: 2010-08-05
I have a form with a TAdo Query.  When you click the button it scrolls through the table and then updates the record.. Or so it should.  e.g.  when running the first record only is updated.  If stepping through in debug/IDE then All records are correctly updated.

Using D7 connecting to Access Database.  HELP PLEASE..

   While not qryDataToCheck.Eof do
     Begin
       //Scroll Through the fields and do the checks on them

       while not cdCheckData.Eof do
         Begin
      {OMITTED bOk False if error found}
       qryDataToCheck.Edit;
       if  Not bOk then
           begin
             if bError then
                  qryDataToCheck.FieldByName('Data_Error_Found').Value := 'E'
             else qryDataToCheck.FieldByName('Data_Error_Found').Value := 'W';
            end
        else
           begin
           qryDataToCheck.FieldByName('Data_Error_Found').Value :=  Null ;
            end;
        qryDataToCheck.FieldByName('Data_Error_Comment').Value := sRecordError;

        qryDataToCheck.Post;
        qryDataToCheck.Next;
      end; //loop qryDataToCheck.eof
0
Comment
Question by:Icart
6 Comments
 
LVL 17

Expert Comment

by:Wim ten Brink
ID: 9597634
It could be a timer-related issue. Maybe without the debugger running, the updates are too fast for Access to handle correctly. Then again, looking at your code extract, I noticed that the last end has a wrong comment. It is related to cdCheckData.Eof and not qryDataToCheck.Eof. So perhaps the problem is related to table-name confusion in your code.
0
 

Expert Comment

by:hetturki
ID: 9597871
first of all why you dont use UPDATE SQL like
Update TableName
set field1 = pla pla , .....
where <condition>

second
try to close the table at end of the procedure the makes the updates to your
table

Best Regards
0
 

Author Comment

by:Icart
ID: 9601414
Apologise for the cdCheckData and The qryDataToCheck loopy bit.  I am actually opening because I omitted code i didn't clip the correct do while..  The code runs perfectly as I say in IDE if I put a break in and then continue.. I have tried put sleep() command before the post and a process messages.  The query rescordset state is open and not executing or fecthing and I am running out of ideas.
0
 

Author Comment

by:Icart
ID: 9776130
I solved it.. Damn ADOQuery's.  I changed the query to a Client Dataset and the code worked FINE!!!  
0
 
LVL 1

Accepted Solution

by:
Computer101 earned 0 total points
ID: 12328370
PAQed, with points refunded (125)

Computer101
E-E Admin
0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
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…
This video discusses moving either the default database or any database to a new volume.
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…

708 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

15 Experts available now in Live!

Get 1:1 Help Now