updating wrong recordset using Datacontrol?

updating wrong recordset using Datacontrol?

Post by Michel Inti » Sun, 26 May 2002 10:17:32


I have code if I need to post it but I'm not at that computer right
now. I can post it when/if needed. thanks :)

I'm writing a program in VB6 that's used to compare records from two
tables.  I'm using 3 recordsets. LeftRS, RightRS and Data3.Recordset
(from the data control on the form).   here's what I try to do:

Data3.Recordset holds all of the records that are identical in both
based on the criteria selected using check boxes (First Name, Last
Name, Age, etc.) and A SELECT statement.   LeftRS has all of the
records in the first table and RightRS has all of the records in the
second table being compared.

(Oh, I decide to not use bound controls for the textboxes that display
the data so as to not allow  the user to accidentally update the

The program presents a side by side comparison showing the two tables'
data in the textboxes. When the user feels indeed this is a duplicate,
s/he marks the "is duplicate" box  and goes to next record, previous
or whatever record s/he desires to work on next, using either the data
controls or buttons I've put on the form to activate .MoveNext or
Code marks the AlreadyViewed field in the tables' as 'True' before
moving on, though.

In the Data control's validate routine, I requery the Data3 recordset
using the same underlying criteria, which includes, checking if the
"AlreadyViewed" value is True.

What's supposed to happen:
the Data3 recordset is supposed to omit the records already viewed.

What happens:
Instead, if the user decides to move several records forward then
return back to the first record, the .Update causes the Wrong Record
to be marked as "Already Viewed".  It marks the farthest record to the
right that the user had gone to,  using the Data control.  It's as if
the cursor got stuck at the
last record the user viewed ( I don't think the recordset is

     current record                 user decides to move all the way
over here

after the update:

  +..current record                 this record is marked instead of

I tried using .FindFirst on LeftRS and RightRS by extracting the 'Name
= Bob' from "WHERE Name = Bob".   .Nomatch is Set to False as expected
but .Findfirst
doesnt't work on the Data Control!?  I wanted to try to make a work
around by using .FindFirst on Data3 but it says I cannot use that
function on the control, not supported.
Also, sometimes the data control does not move to the next record like
it should when I press the  |> button.

.AbsolutePosition in the debug window shows that the data control
seems to lag behind 1 or more positions whenever a Move occurs also.
I checked by putting in  the Validate event
             |____________ is this the right place to check ?

    debug.print & Data3.Recordset.AbsolutePosition

I also checked in the onChange event for the FirstName textbox. Here,
.AbsolutePosition is always correct, I guess because if the data
changes then the position has also changed.

What could I be doing wrong?