S
Shaw
I have Access 2003 DAO linked via odbc to MS SQL
In the on-delete event of a table I add a record to a log table (Diffrent
table than one record deleded from)
When user selects 1 record to delete all ok.
(Record deleted & recorcd added to Log table)
When user selects 2 or more records the return from ODBC on the set
statement of the log table is a time out.
(Works fine if linked to jet)
The delete is only event that is called as each record is processed, the
before/after confirmation is just called once after access looped thru all
delete events.
Any suggestions welcome!
-----------
'---------------- Sample code with northwind db - simple tablular list form
for customer table - added few dummy customers ---------
' just some dummy code to simulate
writing out a record to a log file on delete
' 1 record deleted works fine but selecting 2 or more records causes timeout
'--------------------------------------------------------------------------------------------------------------------------------------
Option Compare Database
Public wrkJet As Workspace
Public gDB As DAO.Database
'----
Private Sub Form_Delete(Cancel As Integer)
On Error GoTo Form_Delete_ERR
Dim RST As DAO.Recordset
Dim MyError As Error
Set RST = gDB.OpenRecordset("dbo_Categories", dbOpenDynaset,
dbSeeChanges)
RST.AddNew
RST!CategoryName = "Dummy1"
RST!Description = Me!CompanyName_F 'deleted record - from current form
RST.Update
RST.Close
Set RST = Nothing
Exit Sub
Form_Delete_ERR:
Cancel = True
If Err.Number = 3146 Then
For Each MyError In DBEngine.Errors
MsgBox MyError.Number & " " & MyError.Description & "
Form_Delete"
Next MyError
Else
MsgBox Err.Number & " " & Err.Description & " Form_Delete"
End If
Exit Sub
End Sub
Private Sub Form_Load()
On Error GoTo Form_Load_ERR
Set gDB = DBEngine.Workspaces(0).Databases(0)
Exit Sub
Form_Load_ERR:
MsgBox Err.Number & " " & Err.Description
Exit Sub
End Sub
In the on-delete event of a table I add a record to a log table (Diffrent
table than one record deleded from)
When user selects 1 record to delete all ok.
(Record deleted & recorcd added to Log table)
When user selects 2 or more records the return from ODBC on the set
statement of the log table is a time out.
(Works fine if linked to jet)
The delete is only event that is called as each record is processed, the
before/after confirmation is just called once after access looped thru all
delete events.
Any suggestions welcome!
-----------
'---------------- Sample code with northwind db - simple tablular list form
for customer table - added few dummy customers ---------
' just some dummy code to simulate
writing out a record to a log file on delete
' 1 record deleted works fine but selecting 2 or more records causes timeout
'--------------------------------------------------------------------------------------------------------------------------------------
Option Compare Database
Public wrkJet As Workspace
Public gDB As DAO.Database
'----
Private Sub Form_Delete(Cancel As Integer)
On Error GoTo Form_Delete_ERR
Dim RST As DAO.Recordset
Dim MyError As Error
Set RST = gDB.OpenRecordset("dbo_Categories", dbOpenDynaset,
dbSeeChanges)
RST.AddNew
RST!CategoryName = "Dummy1"
RST!Description = Me!CompanyName_F 'deleted record - from current form
RST.Update
RST.Close
Set RST = Nothing
Exit Sub
Form_Delete_ERR:
Cancel = True
If Err.Number = 3146 Then
For Each MyError In DBEngine.Errors
MsgBox MyError.Number & " " & MyError.Description & "
Form_Delete"
Next MyError
Else
MsgBox Err.Number & " " & Err.Description & " Form_Delete"
End If
Exit Sub
End Sub
Private Sub Form_Load()
On Error GoTo Form_Load_ERR
Set gDB = DBEngine.Workspaces(0).Databases(0)
Exit Sub
Form_Load_ERR:
MsgBox Err.Number & " " & Err.Description
Exit Sub
End Sub