473,382 Members | 1,445 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

Deleting record from subform in 2007

167 100+
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
1 4149
ChipR
1,287 Expert 1GB
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

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

Similar topics

0
by: Steve | last post by:
In AccessXP in Access2000 mode --- TblCustomer: CustomerID, CustomerName TblOrder: OrderID, CustomerID, OrderDate TblOrderDetail: OrderDetailID, OrderID, Detail Appropriate...
1
by: Mark | last post by:
This question refers to a main form with a continuous form subform. After an error occurs after entering several records in the subform, how can I delete all the data in the main form and all the...
0
by: RAllsopp | last post by:
I am having trouble deleting a record from a subform. I actually have a main form with two subforms, one dependent on the record selected in the other. The user selects a record to view on the...
1
by: KC | last post by:
Hello, I am using Access 2002. WinXP, Template from MS called Orders Mgmt DB. I have tweaked this DB to work for our small co. It has worked pretty well up until I made the mistake of deleting...
46
by: DP | last post by:
hi, i've got a form, with a subform in it. i've got a delete button in the subform. the code i;ve got is; Private Sub cmdDeleteRecord_Click() msg = "Are you sure you want to delete this...
2
by: paula | last post by:
I have a front-end access database that uses a sql server back-end to link the tables. When I run the following code, the subform displays #deleted in place of the deleted record. What am I doing...
1
by: stuart | last post by:
I have a list of records in a subform that a user can either edit or delete. This is an unbound form. If the user deletes a record, I want to refresh the form, and then position the cursor on the...
4
by: banderson | last post by:
Hello, I am having a problem getting a new record in a subform to append to the underlying table. When I add a new record to the main form, the subform is blank, except for the ID field, which is...
4
by: sphinney | last post by:
I'm not exactly sure how to start this post. My question is pretty simple, but it will take a little bit of context before I can state it. (And thanks in advance for taking the time to read this!) ...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.