Re: Button to delete record on datasheet subform
- From: "Robert" <cpq1bcle[REMOVE]@verizon.net>
- Date: Sat, 24 May 2008 21:22:07 -0400
Thank you. It works but it will not delete mulitple records like the icon.
Is there any way to make it delete more than 1 record?
"Wayne-I-M" <WayneIM@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:200514FE-37B3-4CD5-9621-6719ECD437B6@xxxxxxxxxxxxxxxx
Private Sub MAINFORMNAME_Click()
Dim rs As DAO.Recordset
With Me.DATASHEETFORMNAME.Form
Set rs = .RecordsetClone
rs.Bookmark = .Bookmark
rs.Delete
Set rs = Nothing
End With
End Sub
Change MAINFORMNAME and DATASHEETFORMNAME
--
Wayne
Manchester, England.
"Robert" wrote:
I have a main form with a data*** subform on it. Records can be
deleted
from the subform by selecting the record and then clicking on the delete
icon on the toolbar. But I want a custom delete button. And you can't
put
a button on a data***. So if I put a button on the main form, what
code
do I use to delete the selected record(s) on the data*** subform? The
following when placed in the button's on click event do not work:
DoCmd.RunCommand acCmdDeleteRecord
and
DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 6, , acMenuVer70
Robert
.
- Follow-Ups:
- Re: Button to delete record on data*** subform
- From: Wayne-I-M
- Re: Button to delete record on data*** subform
- References:
- Button to delete record on data*** subform
- From: Robert
- Button to delete record on data*** subform
- Prev by Date: A button command to dial Skype?
- Next by Date: Re: creating tables with VBA
- Previous by thread: Button to delete record on data*** subform
- Next by thread: Re: Button to delete record on data*** subform
- Index(es):