D
Dave
No matter what I've done, code quits running after a record deletion
(even a simple Msgbox "OK" to test after the deletion does not
trigger).
Relevant (?) form properties: continuous, allow additions (no); data
entry (no); record locks (edited record). I have tried both the
DoMenuItem and RunCommand acCmdDeleteRecord methods with no
difference. I also migrated the record deletion portion to a form
function thinking that if it were external to the button click event
sub, it would HAVE to return program control back to the sub and
execute the rest of the code. If I rem out the delete portion to test
the variables, all is OK. Here's my code (error trapping removed for
brevity):
Private Sub cmdDelRec_Click()
Dim recDeleted As Boolean
recDeleted = delRecord
msgbox "OK"
If recDeleted = True Then
Me.Requery
recalcAmounts strDept, lngRel
End If
End Sub
Function delRecord() As Boolean
If Me.CurrentRecord > 0 Then
delRecord = True
DoCmd.RunCommand acCmdSelectRecord
DoCmd.RunCommand acCmdDeleteRecord
Else
delRecord = False
End If
End Function
Could someone please tell me why the code stops executing after the
record delete and how I might overcome it? Using Access 2002, XP, SP3
P.S. the form recordset is a temp table designed to facilitate
temporary calculations so it has no primary key. Using a delete sql
would be problematic due to reams of code that would have to be
modified.
(even a simple Msgbox "OK" to test after the deletion does not
trigger).
Relevant (?) form properties: continuous, allow additions (no); data
entry (no); record locks (edited record). I have tried both the
DoMenuItem and RunCommand acCmdDeleteRecord methods with no
difference. I also migrated the record deletion portion to a form
function thinking that if it were external to the button click event
sub, it would HAVE to return program control back to the sub and
execute the rest of the code. If I rem out the delete portion to test
the variables, all is OK. Here's my code (error trapping removed for
brevity):
Private Sub cmdDelRec_Click()
Dim recDeleted As Boolean
recDeleted = delRecord
msgbox "OK"
If recDeleted = True Then
Me.Requery
recalcAmounts strDept, lngRel
End If
End Sub
Function delRecord() As Boolean
If Me.CurrentRecord > 0 Then
delRecord = True
DoCmd.RunCommand acCmdSelectRecord
DoCmd.RunCommand acCmdDeleteRecord
Else
delRecord = False
End If
End Function
Could someone please tell me why the code stops executing after the
record delete and how I might overcome it? Using Access 2002, XP, SP3
P.S. the form recordset is a temp table designed to facilitate
temporary calculations so it has no primary key. Using a delete sql
would be problematic due to reams of code that would have to be
modified.