The point of using transaction is to be able to execute multiple statements (insert, delete, update) and then commit changes or roll everything back in case of error.
You may use transaction to update single table but in your case I don't much point in it since it appears that both tables relate on ID (id=7).
So, what I would do is to use single transaction to update both tables:
Code:Option Explicit Private Sub cmbSumit() On Error GoTo ErrHandler Conn.BeginTrans Conn.Excute "update H1 set Fname = 'City1' where FieldID=7" Conn.Excute "update D1 set name = 'Ram' where FieldID=7" Conn.CommitTrans Exit Sub ErrHandler: MsgBox Err.Description Conn.RollbackTrans Err.Clear End Sub




Reply With Quote
