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

Deleting record from subform in 2007

P: 167
I think I am just having a 'brain fog' moment... I can not remember how to do this. I have a main form and on the main form I have a subform(sfDetails). My subform is in datasheet view. I put a command button on my main form 'Delete Record'. I want to highlight a row on my datasheet(subform) and click the delete button on the main form and have it delete the record I have highlighted in the subform. I have used the following code behind the button: DoCmd.RunCommand acCmdSelectRecord
DoCmd.RunCommand acCmdDeleteRecord

This is not deleting the data on my datasheet(subform). I know I am doing something incorrect, just not sure what!
Jul 16 '09 #1
Share this Question
Share on Google+
1 Reply

Expert 100+
P: 1,287
I couldn't remember this either, had to look it up:
Expand|Select|Wrap|Line Numbers
  1. mySubForm.Form.Recordset.Delete
  2. mySubForm.Form.Recordset.MoveNext
Jul 16 '09 #2

Post your reply

Sign in to post your reply or Sign up for a free account.