ADO - delete/ update recordsets

B

Ben

Hi all,

Environment: Access2003, WinXP. ADO
1. I have a disconnected recordset tied to a form, if I deleted a record on
the form, I want to be able to jump to the next record and the record count
decreased by 1 immediately reflected. For example if the record navigator
has shows 10 records and I am currently on the 3rd record, if I click a
delete button on the form, I like the form to show the next record, so that
the record navigator would show record 3 of 9. That is possible?

Can you show me how I can accomplish that?
If I then reconnect the recordset to the database and do a batch update, it
would just remove the record from the table?


2. Is there a way to test for an ADO disconnected recordset to see if anyone
of the record has been modified. If there is, I want to use this flag to do
something like this:

rs.updatebatch


Thanks so much,

Ben



--
 
M

Michel Walsh

I foresee many problems, but if your recordset is disconnected, the Access
form (using DAO, not ADO) is tied to the database which is... NOT CONNECTED
.... to your disconnected recordset, so, there is no way the communication
could established all by itself. And even if you resynch, your Access form
will probably have to be requeried (at least, in order to see newly added
records).

As long as your recordset is disconnected, there is no connection with the
database, so no, you cannot see if anyone has modified a record or not, as
long as you don't try to resynch with the database (kind of like a light
replication). In ADO.Net (I don't remember the details of ADO itself), a
disconnected recordset keep the oldvalues for each modified fields and, to
know if someone ELSE has changed or not the same record, at
resynchronization, it looks to see if all the fields, in the database, have
their database value equal to the oldvalue in the recordset: if so, no one
has modified the record in the database (or if they do, they undo it),
otherwise, someone has change the field, so there is a possible 'conflict'
to be solved. So, in short, you can try to make a resynchronization and see
if there is a report of any conflict (and you choose to lose the conflict).
Sure, you can also try to read the actual values in the database, for a
given record, and compare those with your own oldvalues. That may be easier
than "resynching" the whole recordset, in some cases.

Vanderghast, Access MVP
 
B

Ben

Michel,

My bad, let me clarify. For (2) wanted to see if there any way to check
whether any of the records IN the disconnected recordset has been modified.

Do you have any thoughts on (1) ?

Thanks,

Ben
 
M

Michel Walsh

For the first part, it seems you should not be using a disconnected
recordset in that case. Otherwise, you have to ''monitor'' the modifications
through a timer, or something similar, from the Access side.


Vanderghast, Access MVP.
 
B

Ben

Michel,

Got it.

Thanks,

Ben

--



Michel Walsh said:
For the first part, it seems you should not be using a disconnected
recordset in that case. Otherwise, you have to ''monitor'' the modifications
through a timer, or something similar, from the Access side.


Vanderghast, Access MVP.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top