J
JJ
I can't seem to delete my most recent record. I have a form ("Direct_frm")
that works great by itself. When I hit the cancel button ("Cancel3") the code
will find the ID and delete it from my table ("Sales_tbl") and close the form
("Sales_frm"). However, when I put it in the form ("Sales_frm") as a subform
the code doesn't seem to work. The record doesn't delete and the form doesn't
close. It might have to do with the refresh???
Any help is appreciated:
Private Sub Cancel3_Click()
On Error GoTo Err_Cancel3
Me.Refresh
CurrentDb.Execute "DELETE * FROM [Sales_tbl] Where [ID] =" &
[Forms]![Direct_frm]![ID]
DoCmd.Close acForm, "Sales_frm", acSaveYes
Err_Cancel3:
If Err.Number = 3075 Then
DoCmd.Close acForm, "Sales_frm", acSaveYes
Else
End If
End Sub
that works great by itself. When I hit the cancel button ("Cancel3") the code
will find the ID and delete it from my table ("Sales_tbl") and close the form
("Sales_frm"). However, when I put it in the form ("Sales_frm") as a subform
the code doesn't seem to work. The record doesn't delete and the form doesn't
close. It might have to do with the refresh???
Any help is appreciated:
Private Sub Cancel3_Click()
On Error GoTo Err_Cancel3
Me.Refresh
CurrentDb.Execute "DELETE * FROM [Sales_tbl] Where [ID] =" &
[Forms]![Direct_frm]![ID]
DoCmd.Close acForm, "Sales_frm", acSaveYes
Err_Cancel3:
If Err.Number = 3075 Then
DoCmd.Close acForm, "Sales_frm", acSaveYes
Else
End If
End Sub