By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,482 Members | 1,002 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,482 IT Pros & Developers. It's quick & easy.

Delete current record

P: n/a
I found this procedure for deleting current record on www site, but is not
working. Can someone help.

Private Sub DeleteCurrentRecord_Click()
If Not (fDelCurrentRec(Me)) Then
MsgBox "An Error occurred!"
End If
End Sub
Function fDelCurrentRec(ByRef frmSomeForm As Form) As Boolean
On Error GoTo Err_Section

With frmSomeForm
If .NewRecord Then
.Undo
fDelCurrentRec = True
GoTo Exit_Section
End If
End With

With frmSomeForm.RecordsetClone
.Bookmark = frmSomeForm.Bookmark
.Delete
frmSomeForm.Requery
End With
fDelCurrentRec = True
Exit_Section:
Exit Function

Err_Section:
fDelCurrentRec = False
Resume Exit_Section
End Function

Your help is greatly appreciated.
Nov 12 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Newbee wrote:
I found this procedure for deleting current record on www site, but is not
working. Can someone help.


<snip>

The code behind the command button could be
Docmd.Runcommand accmddeleterecord

In your BeforeDel event for the form enter
Docmd.SetWarnings False
In your AfterDel event enter
Docmd.SetWarnings True
In your OnDel event enter
If msgbox("Are you sure you want to delete this recorfd?",vbYesNo,"Confirm
Delete") = vbNo then Cancel = True

Nov 12 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.