Hi,
it's been a while since I used DAO, what type of PC do you have ..CPU ; Memory etc..
a few questions
how many records ar in the Table
do you how many records are going to be deleted (just roughly)
try this...
Code:Private Sub Command2_Click() ' Dim db As DAO.Database ' Dim qdf As DAO.QueryDef ' ' Set db = DBEngine.OpenDataBase(".\NorthWind.mdb") ' Set qdf = db.QueryDefs("qryDeleteByID") ' 'Set the value of the QueryDef's parameter ' qdf.Parameters("prmID").Value = "10252" ' 'Execute the query ' qdf.Execute dbFailOnError ' 'Clean up ' qdf.Close ' Set qdf = Nothing ' Set dbs = Nothing On Error GoTo DAOTransactions_Err Dim wks As DAO.Workspace Dim db As DAO.Database Dim strSql As String Dim prmID As Long Dim bTrans As Boolean ' Get the default workspace Set wks = DBEngine.Workspaces(0) ' Open the database Set db = wks.OpenDataBase(".\NorthWind.mdb") ' Begin the Transaction wks.BeginTrans prmID = 10255 bTrans = True strSql = "Delete * FROM tbl_TestDelete WHERE OrderID=" & prmID ' MsgBox strSql db.Execute strSql ' Commit the transaction wks.CommitTrans Exit Sub Set db = Nothing Set wks = Nothing DAOTransactions_Err: If bTrans Then wks.Rollback Debug.Print DBEngine.Errors(0).Description Debug.Print DBEngine.Errors(0).Number End Sub
regards
Chris




Reply With Quote
