Click here to Skip to main content
15,924,036 members
Home / Discussions / Database
   

Database

 
GeneralRe: A custom key Pin
Mekong River10-Nov-04 4:14
Mekong River10-Nov-04 4:14 
GeneralRe: A custom key Pin
totig10-Nov-04 19:26
totig10-Nov-04 19:26 
GeneralRe: A custom key Pin
Colin Angus Mackay10-Nov-04 6:53
Colin Angus Mackay10-Nov-04 6:53 
QuestionHow to update record Pin
Mekong River9-Nov-04 17:20
Mekong River9-Nov-04 17:20 
AnswerRe: How to update record Pin
Mekong River9-Nov-04 17:46
Mekong River9-Nov-04 17:46 
Generalado and radio button Pin
skicrud9-Nov-04 6:06
skicrud9-Nov-04 6:06 
GeneralRe: ado and radio button Pin
Mekong River9-Nov-04 14:28
Mekong River9-Nov-04 14:28 
GeneralDAO and transactions Pin
calliscope9-Nov-04 5:34
calliscope9-Nov-04 5:34 
Mon problème est de créer une transaction sous ACCESS 2003 en VB comprenant deux requêtes:

- une requête de suppression d'un enregistrement dans une table distante liée par un pont ODBC
- la suppression du même enregistrement dans la table locale liée au formulaire sur lequel est placé le bouton qui lance la routine suivante:

Un warning s'affiche à l'éxécution de la suppression de l'enregistrement courant:


DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 6, , acMenuVer70


En répondant NON à ce warning : "voulez vous supprimer...", une erreur se produit(jusque là tout est normal),

Alors le wks.Rollback devrait restaurer la suppression effectuée (rst.Delete) or il n'en est rien
Ce qui désynchronise mes deux bases.

pourquoi le rollback ne s'effectue pas?

voici mon code:

'macro du formulaire lié à la table locale membres
Private Sub ButDel_Click()
'** Bouton Supprimer
Dim TransStarted As Boolean
Dim db As DAO.Database
Dim wks As DAO.Workspace
Dim rst As DAO.Recordset


'Creation du workspace
Set wks = DBEngine(0)
'début de la transaction
wks.BeginTrans
TransStarted = True

'base courante
Set db = wks(0)

'selection de l'enregistrement à supprimer dans la table fiches_annuaire(table liée ODBC)
sqltext = "select * from fiches_annuaire where code = " & Me.ID

Set rst = db.OpenRecordset(sqltext, dbOpenDynaset)

On Error GoTo ErrDel

rst.MoveFirst ' goto the first record that needs to be inserted
'suppression de l'enregistrement(table liée ODBC)
rst.Delete

'supression de l'enregistrement dans la table liée au formulaire
DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 6, , acMenuVer70
MsgBox "base locale mise à jour", vbOKCancel

'on termine la transaction
If TransStarted Then
wks.CommitTrans
rst.Close
wks.Close
Set wks = Nothing
End If
TransStarted = False

GoTo endsub

ErrDel:
'PopupError
message = "Une erreur est survenue. Pour assurer la synchronisation des deux bases, aucune suppression n'a été effectuée " & vbCrLf & _
"Veuillez recommencer ultérieurement"

glyph = vbExclamation
Title = "Transaction annulée"
'on annule la transaction

If TransStarted Then
wks.Rollback
rst.Close
wks.Close
Set wks = Nothing
MsgBox message & "rollback?", glyph, Title
Else
MsgBox "pas de rollback!", glyph, Title
End If

TransStarted = False
GoTo sql_error_exit:
'Resume Next

sql_error_exit:
Exit Sub

endsub:
On Error GoTo 0

End Sub
Generalusing SQL Distinct Pin
Ahmed Galal9-Nov-04 2:44
Ahmed Galal9-Nov-04 2:44 
GeneralRe: using SQL Distinct Pin
Colin Angus Mackay9-Nov-04 10:42
Colin Angus Mackay9-Nov-04 10:42 
GeneralRe: using SQL Distinct Pin
Ahmed Galal10-Nov-04 2:11
Ahmed Galal10-Nov-04 2:11 
GeneralSql Error Pin
nacp8-Nov-04 23:24
nacp8-Nov-04 23:24 
GeneralRe: Sql Error Pin
David Salter8-Nov-04 23:26
David Salter8-Nov-04 23:26 
GeneralRe: Sql Error Pin
Mekong River9-Nov-04 14:32
Mekong River9-Nov-04 14:32 
QuestionPrecision and Scale ? Pin
0v3rloader8-Nov-04 4:32
0v3rloader8-Nov-04 4:32 
AnswerRe: Precision and Scale ? Pin
Richard Deeming8-Nov-04 4:45
mveRichard Deeming8-Nov-04 4:45 
GeneralSQLite Pin
Steve S8-Nov-04 0:46
Steve S8-Nov-04 0:46 
GeneralSQL Server Management API Pin
Its due when7-Nov-04 18:33
Its due when7-Nov-04 18:33 
GeneralTrouble in updating source in ADO Pin
wicked_guy7-Nov-04 2:13
wicked_guy7-Nov-04 2:13 
GeneralFrom one database to another (DataSets & .NET) Pin
Jon Rista5-Nov-04 9:28
Jon Rista5-Nov-04 9:28 
QuestionUrgent!!--Layer Isolation using ArrayList?? Pin
obymathew4-Nov-04 23:48
obymathew4-Nov-04 23:48 
AnswerRe: Urgent!!--Layer Isolation using ArrayList?? Pin
Daniel Turini9-Nov-04 0:47
Daniel Turini9-Nov-04 0:47 
GeneralWorking with just time section of a datetime type Pin
Den2Fly4-Nov-04 21:56
Den2Fly4-Nov-04 21:56 
GeneralRe: Working with just time section of a datetime type Pin
Colin Angus Mackay4-Nov-04 22:14
Colin Angus Mackay4-Nov-04 22:14 
GeneralRe: Working with just time section of a datetime type Pin
Den2Fly7-Nov-04 1:45
Den2Fly7-Nov-04 1:45 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.