Thanks for your reply. I am the creator and maintainer of the db. Unfortunately, I was not as organized I should have been while creating. I added every table from about 4 SQL databases and, now, am only using about 7 tables out of a couple hundred. I am going to transition this database to someone here in the next few weeks and I do not want to scare them with all of the unused tables.
Back to what you were saying about the querys and the loops. Lets just focus on the queries for now. Do you know of any code that will allow me to loop through the sql statements of a query and pull back the text? That will be very helpful. I could create a function that returned a 1 or 0 if the a table name exists in any of my query's code. I could then store the tablenames in a separate table and view them when I am finish. If I am satisfied with the results I can create a statement that will delete any table that is not in the tablenames table.
My problems with this is: I do not know how to look a the sql for a query(In VBA). and I do not know how to Loop through the tables and the tablenames in a database using VBA.
If you have any suggestions regarding the code, it would be greatly appreciated.
Thanks,
Wren