updating wrong recordset using Datacontrol? 
Author Message
 updating wrong recordset using Datacontrol?

Hello,

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
tables,
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
data.)

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
.MovePrevious.
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
adForwardOnly)

     current record                 user decides to move all the way
over here
  +...............V.................V.......................................

after the update:

  +..current record                 this record is marked instead of
current
  +...............V.................X....

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,
the
.AbsolutePosition is always correct, I guess because if the data
changes then the position has also changed.

What could I be doing wrong?
Thanks



Wed, 10 Nov 2004 09:17:32 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. Question on Problem encountered w/ using ADODC DataControl.Recordset Property w/ ADODB.Recordset objects

2. Question on Problem encountered w/ using ADODC DataControl.Recordset Property w/ ADODB.Recordset objects

3. Datacontrol.recordset = other recordset

4. Setting Datacontrol.recordset = other recordset

5. Recordset converts number to string using wrong locale?

6. Help Updating table by using a recordset

7. Update a field in each record of a table using a recordset

8. Batch update for multiple tables using single ADO Recordset (VB )

9. How to update a field with the recordset using a string variable

10. Problem with recordSet.update using DAO and ODBC Direct

11. Using the .Update method with and ADO recordset

12. Cant Update Recordset that uses SQL

 

 
Powered by phpBB® Forum Software