Results 1 to 3 of 3
  1. #1
    Join Date
    Sep 2006
    Posts
    34

    Unanswered: help with rollback

    Hi I am trying to get a rollback working but don`t really understand, so after a little help.

    this is my code so far :

    Dim CurConn2 As New ADODB.Connection
    Dim rst2 As New ADODB.Recordset
    Dim CurDB2 As Database

    Set CurDB2 = CurrentDb
    Set CurConn2 = New ADODB.Connection

    With CurConn2
    .Provider = "Microsoft.Jet.OLEDB.4.0"
    .ConnectionString = "data source= " & CurDB2.name
    .Open
    End With
    CurConn2.BeginTrans

    Set rst2 = New ADODB.Recordset
    rst2.CursorType = adOpenDynamic
    rst2.LockType = adLockOptimistic
    rst2.Open "tbl_lkoverride", CurConn2, , , adCmdTable
    rst2.addnew
    rst2![overidereason] = Me.oReason

    rst2.Update

    ' Ask if the user wants to commit to all the changes
    ' made above.
    If MsgBox("Save all changes?", vbYesNo) = vbYes Then
    CurConn2.CommitTrans
    Else
    CurConn2.Rollback
    rst2.MoveFirst
    End If


    ' clean up
    rst2.Close
    CurConn2.Close
    Set rst2 = Nothing
    Set CurConn2 = Nothing

    I get an error when it reaches the rollback "Expected query after excute"

    Many Thanks

  2. #2
    Join Date
    Apr 2005
    Location
    Zagreb - Croatia
    Posts
    372

    Hello James!

    Look at "DemoRollbackA2000.mdb",
    I think it can help you.
    Attached Files Attached Files

  3. #3
    Join Date
    Sep 2006
    Posts
    34
    Many Thanks

    I will have a look

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •