Deleteing Records on a form not working

M

MMcCalmon

The following code is attached to a command button on a subform thatis
supposed to delete the selected record, but it's not working.
The subform is record source is a query. The subform properties have
the AllowEdits and AllowDeletes propertry set to true.

Private Sub cmdDelete_Click()
' Purpose: to delete the current record from the subform
' listing the existing applied BMPs.
'
Const cstrProc As String = "cmdDelete_Click"
On Error GoTo cmdDelete_Click_Err

Dim intCurRec As Integer

Set db = CurrentDb

intCurRec = Me.CurrentRecord

Set rs = db.OpenRecordset("trelActivityTracker")

With rs
..Move intCurRec - 1
..Delete
..Close
End With

Me.Requery

Forms!frmBMPBuilder.Requery


cmdDelete_Click_Exit:
Exit Sub

cmdDelete_Click_Err:
Call ErrMsgStd(Me.Name & "." & cstrProc, Err.Number, Err.Description,
True)
Resume cmdDelete_Click_Exit

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top