Transaction problems

INFOS

Registered User.
Local time
Today, 21:16
Joined
Jan 15, 2005
Messages
55
WHAT IS WRONG WITH THIS CODE:

Dim wsp As Workspace
Dim fInTrans As Boolean

On Error GoTo C4Err

fInTrans = False
Set wsp = DBEngine.Workspaces(0)

wsp.BeginTrans
fInTrans = True

DoCmd.OpenQuery "query1"
DoCmd.OpenQuery "query2"
DoCmd.OpenQuery "query3"
DoCmd.OpenQuery "query4"

wsp.CommitTrans

C4Exit:
Set wsp = Nothing
Exit Sub

C4Err:
MsgBox Err.Description
If fInTrans Then
wsp.Rollback
End If
Resume C4Exit

I WANT TO RUN 4 BIG APPEND QUERYS BUT IF USER PRESS ESCAPE BUTTON BEFORE ALL QUERYS ARE FINISHED - THEN ALL RECORD CHANGES MADE BY THOSE QUERYS MUST BE CANCELED.
SO I MADE THIS CODE. BUT IT DOES NOT WORK.
 

Users who are viewing this thread

Back
Top Bottom