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

Delete Current Record In Subform

P: n/a
Is there another way to delete the current record in a subform from the main
form, another subform or a sub-subform other than setting focus on a field
in the subform and using run command acCmdDelete Record?

Thanks!

Maria
Nov 13 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
You can use the Execute Method to run a Delete Query in code.

However, if the Subform (which shows the deleted Record) is visible, you
will need to re-query the Subform to remove the deleted "row" from the
RecordSource. Otherwise, you Subform will show a row of "#Deleted" entries.

The acCmdDeleteRecord looks after the Requery for you.

--
HTH
Van T. Dinh
MVP (Access)


"Maria" <mm*****@earthlink.net> wrote in message
news:b3*****************@newsread3.news.atl.earthl ink.net...
Is there another way to delete the current record in a subform from the main form, another subform or a sub-subform other than setting focus on a field
in the subform and using run command acCmdDelete Record?

Thanks!

Maria

Nov 13 '05 #2

P: n/a
Van,

A Delete Query works off a table so somehow you have to identify the primary
key value of the record you want to delete. acCmdDeleteRecord works off the
form and automatically knows which record to delete - the current record.
I'm looking for another method that works off the form and knows to delete
the current record. I have a subform several layers deep where I want to
delete the current record. It takes a lot of lines of code to set focus on
the record. I'm looking for a simpler way to delete the record.

Maria
"Van T. Dinh" <Va***********@discussions.microsoft.com> wrote in message
news:#$**************@TK2MSFTNGP11.phx.gbl...
You can use the Execute Method to run a Delete Query in code.

However, if the Subform (which shows the deleted Record) is visible, you
will need to re-query the Subform to remove the deleted "row" from the
RecordSource. Otherwise, you Subform will show a row of "#Deleted" entries.
The acCmdDeleteRecord looks after the Requery for you.

--
HTH
Van T. Dinh
MVP (Access)


"Maria" <mm*****@earthlink.net> wrote in message
news:b3*****************@newsread3.news.atl.earthl ink.net...
Is there another way to delete the current record in a subform from the

main
form, another subform or a sub-subform other than setting focus on a field in the subform and using run command acCmdDelete Record?

Thanks!

Maria


Nov 13 '05 #3

P: n/a
Not AFAIK beside setting Focus on the SubForm then SubSubForm then
SubSubSubform ...

OTOH, I limit my user interface to ONE level of Subforms. In my experience,
users get very confused with nested Subforms. Afterall, the users don't
know and don't need to know the relationships between Tables like developers
are supposed to know.

--
HTH
Van T. Dinh
MVP (Access)


"Maria" <mm*****@earthlink.net> wrote in message
news:Sd*****************@newsread3.news.atl.earthl ink.net...
Van,

A Delete Query works off a table so somehow you have to identify the primary key value of the record you want to delete. acCmdDeleteRecord works off the form and automatically knows which record to delete - the current record.
I'm looking for another method that works off the form and knows to delete
the current record. I have a subform several layers deep where I want to
delete the current record. It takes a lot of lines of code to set focus on
the record. I'm looking for a simpler way to delete the record.

Maria

Nov 13 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.