Question : MSAccess - Remove all forms & tables using VB?

Hello,

Is it possible to delete all the forms and queries from a database using VB from within the same database.  I guess I'd like for the routine to be generic enough not to have to specify each form and query to be deleted, rather just identify the handful of ones I'd like to retain.

Can someone recommend an approach to accomplish this task?

My intent is to retain a select number of forms/queries as well as all the tables, relationships, defined references and existing modules.  This is to support an un-replication task I'd like to accomplish.  I performed the task manually twice in the last 2 weeks (don;t ask, it's been a long week) ;) I'm looking to automate just a bit.

Thanks!


Note:  40 tables, 275 queries

Answer : MSAccess - Remove all forms & tables using VB?

here is the code that  will delete all the queries

Sub delAllQ()
Dim db As DAO.Database, i
Set db = CurrentDb
    For i = 0 To db.QueryDefs.Count - 1
        DoCmd.DeleteObject acQuery, db.QueryDefs(i).Name
    Next i

End Sub
Random Solutions  
 
programming4us programming4us