Greetings all
I have main form/subform set up and i wanted to include a delete button on the main form( the undo created with wizard button doesnt work ) .
I have tried the code below but it takes like 2 minutes to execute. Deleting just a few records(like 4).
tblBooking is main table and tblBookingDetails is the child table. BookingID is PK for main and FK in child.
Here is the code i tried
I am looking for guidance on a faster way of doing it.
Thanks
Ronald.
I have main form/subform set up and i wanted to include a delete button on the main form( the undo created with wizard button doesnt work ) .
I have tried the code below but it takes like 2 minutes to execute. Deleting just a few records(like 4).
tblBooking is main table and tblBookingDetails is the child table. BookingID is PK for main and FK in child.
Here is the code i tried
Code:
Private Sub cmdDelete_Click()
Dim strSql2 As String
Dim strSql3 As String
On Error GoTo ErrorMine
strSql3 = "DELETE * From " & _
"tblBookingDetails Where BookingID = " & Me!BookingID
strSql2 = "DELETE * From " & _
"tblBookings Where BookingID = " & Me!BookingID
DoCmd.RunSQL strSql3
DoCmd.RunSQL strSql2
cmd_Exit:
Exit Sub
ErrorMine:
MsgBox "Error" & Err.Description
Resume cmd_Exit
End Sub
Thanks
Ronald.