ouestque
asked on
Access: Delete Current Record
I have a table (Name: "Main_Table" Columns: "Name", "SS#") Each record is distinct in this table
I have a subform (Recordsouce: "Main_Table" ---has 2 textboxes with control source: "Name", "SS#" ---The default view is set to "Continuous Forms" so that I can see all records in "Main_Table". Also "Allow Edits" is disabled because I want to force the user to press a "Delete button" so that code will be run.
In the footer of this subform is a button titled "Delete". How do I make it so that when users selects a record in the subform and click the button titled "Delete", my database will delete the selected record?
I am using the example code below I found on line, but it does not work, because "Allow Edits" is set to "no".
Sample Code:
DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 6, , acMenuVer70
I have a subform (Recordsouce: "Main_Table" ---has 2 textboxes with control source: "Name", "SS#" ---The default view is set to "Continuous Forms" so that I can see all records in "Main_Table". Also "Allow Edits" is disabled because I want to force the user to press a "Delete button" so that code will be run.
In the footer of this subform is a button titled "Delete". How do I make it so that when users selects a record in the subform and click the button titled "Delete", my database will delete the selected record?
I am using the example code below I found on line, but it does not work, because "Allow Edits" is set to "no".
Sample Code:
DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 6, , acMenuVer70
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I want to thank ya'll so much for the help. Rick Rickards came up with the solution and got there first so he gets the points. Thank ya'll both agiain for your feedback!!!
Glad to be of help. :)
Me.AllowEdits =True
DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 6, , acMenuVer70
Me.AllowEdits = False
No?