Solved

TAdoQuery Not Updating All Records at runtime

Posted on 2003-10-21
6
158 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

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

Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

919 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

20 Experts available now in Live!

Get 1:1 Help Now