I have a delete button which first deleting data from child table based on choosed record from access form and then it should delete also parent record from main table.
its doing deletion from child table quickly but when it goes to next line to delete parent record it gives error of timeout expired
frontend--> access
backend--> sql-server
code is here, any help will be appriciated..........please help
Private Sub cmd_DeleteRecords_Click()
On Error GoTo Err_cmd_DeleteRecords_Click
Dim I As Long
Dim F As Form
Dim ii As Long
Dim sRepAttDetID As Variant
Dim rs As ADODB.Recordset
Dim rsdetail As New ADODB.Recordset
Dim RunSelect16Cmd As New ADODB.Command
Dim rsRepAttrList As New ADODB.Recordset
Dim RunSelect17Cmd As New ADODB.Command
Dim rsRepAttrList1 As New ADODB.Recordset
If MsgBox("Do you really want to delete selected records", vbOKCancel, "Records Deletion") = vbOK Then
Set F = Forms!frm_maingui!NavigationSubform.Form
'Set F = Forms!Frm_Reports
Set rs = F.RecordsetClone
If rs.RecordCount <= 0 Then
Exit Sub
End If
rs.MoveFirst
rs.Move IntSelTop - 1
For I = 1 To IntSelHeight
sRepAttDetID = rs![Detail_ID]
InitCommand RunSelect16Cmd, "DELETE FROM Tbl_AttributeDetail where Detail_ID= " & sRepAttDetID & " "
Set rsRepAttrList = ExecuteCommand(RunSelect16Cmd)
InitCommand RunSelect17Cmd, "DELETE FROM Tbl_Detail where Detail_ID= " & sRepAttDetID & " "
Set rsRepAttrList1 = ExecuteCommand(RunSelect17Cmd)
rs.MoveNext
Next I
Else
MsgBox "cancel"
End If
Set RunSelect16Cmd = Nothing
Set rsRepAttrList = Nothing
Set RunSelect17Cmd = Nothing
Set rsRepAttrList1 = Nothing
Exit_cmd_DeleteRecords_Click:
Exit Sub
Err_cmd_DeleteRecords_Click:
MsgBox Err.Description
Resume Exit_cmd_DeleteRecords_Click
End Sub