Delete Access Form From Excel using vba

Abhi24

New Member
Joined
Mar 1, 2016
Messages
3
Hi,
I have 2 forms in an access database (access 2007-10). I am trying to delete these forms using vba in an excel workbook.
My access database has NO database password but the VBA project in access HAS a password. In the access database I have created a sub procedure (named DeleteAll) which contains the following code for each form.

Code:
Docmd.DeleteObject acform, <formname>

When I call this code from my excel vba, the Access database gives me an error -

Run-time error '2017': Microsoft helps protect this Visual Basic for Applications Project with a password. You must supply the password in the Visual Basic Editor before you can perform this operation.

Funny thing is if I were to delete a query using this method, it gets deleted easily. I am experiencing this problem with forms only. Please help.</formname>
 

Excel Facts

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).
Since you can open the database and delete the two forms in a few seconds I would not spend time on this. No reason to do it from Excel.
 
Upvote 0
I am creating an automated tool. After a period of time, the excel along with the forms should be deleted but the data in the tables should remain. I could not find a direct way of doing this from access itself. So, I am going via excel to delete the forms.
 
Upvote 0
Why not have the data in a separate, back-end, database and the forms in a front-end database?

Then when you want to delete the forms just delete the front-end database.
 
Upvote 0

Forum statistics

Threads
1,223,721
Messages
6,174,096
Members
452,542
Latest member
Bricklin

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top