If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Is it possible to include Begin And End Transaction code in VBA ?
Hi,
I took over a project and recenly converted the database from ACCESS 97/SQL 7 to MS ACCESS XP/SQL Sever 2000. The database object is use is DAO. The users have been run into a lot of locks problem after the update. We installed the SQL Server Standard version with default setting. I did some research that the best way to handle the lock to have control over the transaction. The previous developer uses Workspace. But as I step throught the code, I don't see the locks been release after the CommitTrans fired and user still hangs... ====================================== Function HandleNullMemID() As Boolean On Error GoTo HandleErr Dim mWS As Workspace Dim strSQL As String Dim boolInTrans As Boolean Set mWS = DBEngine.Workspaces(0) Set mDB = CurrentDb() mWS.BeginTrans boolInTrans = True 'Append unmatched records to exceptions tbl strSQL = "qryMemPayImpExceptions" mDB.Execute strSQL 'Delete unmatched records from import tbl strSQL = "qryMemPayImpExceptionsDelete" mDB.Execute strSQL mWS.CommitTrans boolInTrans = False HandleNullMemID = True HandleExit: If boolInTrans = True Then mWS.Rollback Exit Function HandleErr: ErrMsgBox Err.Description, basName & ".HandleNullMemID", Err.Number HandleNullMemID = False Resume HandleExit End Function =========================================== Please advise Thanks Jean |
Thread Tools | |
Display Modes | |
|
|