May 21 2012, 07:45 AM
I used the following codes to delete form, but the form is not deleted
DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 6, , acMenuVer70
but if I go to the table I am able to delete it manually. Please help
May 21 2012, 08:01 AM
Try this instead.
DoCmd.DeleteObject acForm, "MyForm"
May 21 2012, 08:03 AM
Since you refer to both a form and a table I'm mot sure what you mean by this.
Are you trying to delete the form object from the application?
or are you trying to delete data that you can see in the form? (All data for all records or just the data for one record)?
May 21 2012, 08:12 AM
Thanks so much guys. Appreciate your help.
I am trying to delete the whole form, not the data in a form, Thanks again
May 21 2012, 08:25 AM
Then what I posted will work. If this is a recurring event, then you might want to include a check like below to avoid errors in the event that it has already been deleted.
Dim obj As AccessObject
Dim objCP As Object
Set objCP = Application.CurrentProject
For Each obj In objCP.AllForms
If obj.name = "MyForm" Then
DoCmd.DeleteObject acForm, obj.name
May 21 2012, 09:17 AM
I've this error message :-
You can't delete the database object "frmManagementApproval" while
Did I do something not right?
May 21 2012, 10:24 AM
You have that form open. It cannot be open if you're trying to delete it. Are you trying to delete the actual form or just the data?
May 21 2012, 10:43 AM
I want to delete the whole form togather with the data.
I've a Delete command button at the footer. I have alot of duplicated forms caused by User, so I open each form and if it is a duplicate, I click "Delete"
to get rid of it. Pleas ehelp
May 21 2012, 11:24 AM
Honestly, it would be faster to just sort the forms and delete them manually.
May 21 2012, 12:07 PM
Thanks Dan. Will do.
May 21 2012, 12:44 PM
Good luck with your project.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here