Results 1 to 5 of 5
  1. #1
    Mazdaspeed6 is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Dec 2010
    Posts
    14

    SQL Transaction question

    Can i run a Begin Transaction command using VBA, run a few other commands than, run a Commit/Rollback command, all as separate commands. Will that have the same effect as a SQL script with a BEGIN TRANSACTION at the beginning and COMMIT/ROLLBACK command at the end?

  2. #2
    weekend00 is offline I may not be right
    Windows XP Access 2003
    Join Date
    Aug 2010
    Posts
    1,295
    you can use transaction process in DAO or ADO.

  3. #3
    Mazdaspeed6 is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Dec 2010
    Posts
    14
    Ok, but would something like this work
    Code:
    tran.CommandText = "BEGIN TRANSACTION"
    tran.Execute
    
    cmd.CommandText = "Some query here"
    cmd.Execute
    
    cmd2.CommandText = "Some other query here"
    cmd2.Execute
    
    com.CommandText = "COMMIT"
    com.Execute
    Not taking into account that this would not compile, would something like this that was coded properly work using ADO

  4. #4
    weekend00 is offline I may not be right
    Windows XP Access 2003
    Join Date
    Aug 2010
    Posts
    1,295
    I don't think so.
    I think transaction can be used in recordset of DAO/ADO. you can get help from accss help about transaction.

  5. #5
    Mazdaspeed6 is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Dec 2010
    Posts
    14
    I found an example here - http://www.java2s.com/Code/VBA-Excel...lbackTrans.htm

    Like you said weekend00, it is used with recordset.

    I found another example of it being used without a recordset http://www.java2s.com/Code/VBA-Excel...ertRecords.htm

    Thanks

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Latest Transaction Report
    By Worm in forum Reports
    Replies: 3
    Last Post: 08-16-2010, 06:10 AM
  2. Urgent: Need to make a transaction form
    By Sheharyar_rr in forum Access
    Replies: 1
    Last Post: 10-31-2009, 10:52 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums