Macro to Delete all Queries and Forms

rbs

Board Regular
Joined
Oct 6, 2002
Messages
58
Hi Everyone,

I need to set up a macro to delete all queries and forms from a database.

Can Anyone help?

Thanks in advance,


Natalie.
 

Excel Facts

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.
Just checking -- why do you want to do that? Is it because you need a new front end for the database but are happy with the data structure?
If so, you could split the database and link a new, blank database to the old backend tables.
If you still want to delete the queries and forms, which version of Access do you use?

Regards
Denis
 
Upvote 0
I have a database for which I create a backup and edit the forms and queries.

Rather than keep track of which I have changed, I delete all the queries and forms and them import them from the backup.

I use Access 2000.

Thanks,


Natalie.
 
Upvote 0
I had an example for Access 97 but went for a browse and found this code on Experts Exchange.

Code:
Look at the following example, you can go through the list of forms..and do whatever...i.e. delete them as well using: 
docmd.DeleteObject acForm,"FormName"

and you can delete any module as well
docmd.DeleteObject acModule,"ModuleName"

Sub AllForms()
    Dim obj As AccessObject, dbs As Object
    Set dbs = Application.CurrentProject
    ' Search for open AccessObject objects in AllForms collection.
    For Each obj In dbs.AllForms
        If obj.IsLoaded = TRUE then
            ' Print name of obj.
            Debug.Print obj.Name
        End If
    Next obj
End Sub
HTH
Denis
 
Upvote 0

Forum statistics

Threads
1,221,569
Messages
6,160,557
Members
451,656
Latest member
SBulinski1975

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