Deleting a Form

J

J.A. Bijkerk

Hello,

I have a database which updates another database. For instance I have
changed in a test database a form.
Then I use the update database to copy the changed form to the original
database.
My question is now: Is it possible to use vba code in the update database to
DELETE a form in the original database?

If so, how?

Thanks

Jaap Bijkerk
 
D

David Lloyd

Jaap:

If your question is how to delete a form in another database, below is one
example of how to accomplish this. I have adjusted the security level to
low while the database is being opened in order to avoid the initial
security warning. You will need a reference to the Office Object Library
for this to run.

Function DeleteForm()
Dim acc As New Access.Application
Dim accAutoSec As MsoAutomationSecurity

'Capture current security setting
accAutoSec = acc.AutomationSecurity

'Reset the security to low temporarily to avoid the security warning
acc.AutomationSecurity = msoAutomationSecurityLow

'Open the database
acc.OpenCurrentDatabase ("C:\MyOriginalDB.mdb")

'Reset the security level
acc.AutomationSecurity = accAutoSec

'Delete the form
acc.DoCmd.DeleteObject acForm, "Form1"

'Quit the database
acc.Quit acQuitSaveAll

Set acc = Nothing
End Function

--
David Lloyd
MCSD .NET
http://LemingtonConsulting.com

This response is supplied "as is" without any representations or warranties.


Hello,

I have a database which updates another database. For instance I have
changed in a test database a form.
Then I use the update database to copy the changed form to the original
database.
My question is now: Is it possible to use vba code in the update database to
DELETE a form in the original database?

If so, how?

Thanks

Jaap Bijkerk
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top