var sidebar_align = 'right';
var content_container_margin = parseInt('290px');
var sidebar_width = parseInt('270px');
Unanswered: Tables displayed within List box
I have seen within the forums the ability to display all the reports in your database in a list box without typing them in. i.e. Database retieves the tables automatically and lists them.
Is it possible to display all the tables that are in the database? and if so does anybody know how?
It's possible to display all the objects of your database. you must just use the good collection
Tabledefs for table
Querydefs for query
Documents for form, report
It depends on what version of Access you are using. If you are still using 97 like me then somehting like this will work for queries:
SELECT MSysObjects.Name FROM MSysObjects WHERE (((MSysObjects.Type)=5) AND ((MSysObjects.Flags)<>3)) ORDER BY MSysObjects.Name;
SELECT MSysObjects.Name FROM MSysObjects WHERE (((MSysObjects.Type)=-32764) AND ((MSysObjects.Flags)=0)) ORDER BY MSysObjects.Name;
Came across this.
Came across this in a book. you may want to try it.
on the load event for your form.
dim strTables as string
dim tdf as AccessObject
for each tdf in currentdata.alltables
strtables = tdf.name & ";"
your_List_Box.rowsource = strtables
I tried it and it works pretty well. Automatically excludes all Sys Tables. Which is nice.
I used DCKunkle's 1st method which I've slightly adapted to exclude MSys Tables.
SELECT MSysObjects.Name FROM MSysObjects WHERE ((Left$([Name],4)<>"MSys") AND ((MSysObjects.Type)=1) AND ((MSysObjects.Flags)<>3)) ORDER BY MSysObjects.Name;
For anyone's reference MSysObjects.types are
= 1 for Tables
= 5 for Queries
= 8 for Relationships
= -32768 for Forms
= -32764 for Reports
= -32761 for Modules
Don't know what the rest are.