Solved

TAdoQuery Not Updating All Records at runtime

Posted on 2003-10-21
6
163 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Get HTML5 Certified

Want to be a web developer? You'll need to know HTML. Prepare for HTML5 certification by enrolling in July's Course of the Month! It's free for Premium Members, Team Accounts, and Qualified Experts.

Question has a verified solution.

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

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
There's a multitude of different network monitoring solutions out there, and you're probably wondering what makes NetCrunch so special. It's completely agentless, but does let you create an agent, if you desire. It offers powerful scalability …
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
Suggested Courses
Course of the Month4 days, 15 hours left to enroll

635 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