Which Object to use for Tansaction process

  • Thread starter Thread starter Roshan Abbasi via AccessMonster.com
  • Start date Start date
R

Roshan Abbasi via AccessMonster.com

One of my routines calls a number of functions, each of which return True in
case of 'Succes' and False in case of 'Failure', as below:

Private Sub SubXmple()
Obj.Begin Trans
if Update_tblA = False then Goto lblRollback
.......
if Update_tblB = False then Goto lblRollback
.......
if Update_tblC = False then Goto lblRollback
.............
Obj.CommitTrans
Exit Sub

lblRollback:
Obj.Rollback
End Sub

My problem is that some of the called functions use a hybrid of the DAO and
the ADO recordsets. In such a case which Object should I use (and how can I
implement the Transaction process).

Any help will be highly appreciated.
 
Roshan,

For DAO use the Workspace object. For ADO use the Connection object.

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia
 
Thanks Graham for the response. But, my actual confusion still persists.
I am wondering, is there any solution for the situation, depicted in my Xmple
procedure, that is, one Transaction process nesting all the function calls,
which use two different types of recordsets.
 
Roshan,

The only way to use a single object to wrap the transactions is if you use
DAO or ADO exclusively. Even then, if you use DAO, you have to use the same
workspace for all transactions. Similarly, if you use ADO, you have to use
the same connection for all transactions.

My advice is to choose one or the other. If you're operating solely on Jet,
then use DAO, otherwise use ADO.

In any case, there's nothing wrong with using two objects, provided you keep
them synchronised.

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia
 
Back
Top