?
Solved

List Tables in a List Box

Posted on 2012-08-23
5
Medium Priority
?
507 Views
Last Modified: 2012-08-23
How do I list the tables that are in my application in a list box?

Thanks.
0
Comment
Question by:Buck_Beasom
5 Comments
 
LVL 75
ID: 38325688
Make this the Row Source of the List Box:

SELECT MSysObjects.Name
FROM MSysObjects
WHERE (((MSysObjects.Type)=1))
ORDER BY MSysObjects.Name;

mx
0
 
LVL 75

Accepted Solution

by:
DatabaseMX (Joe Anderson - Microsoft MVP, Access and Data Platform) earned 2000 total points
ID: 38325902
Mod to not show MSys tables (system tables):


SELECT MSysObjects.Name
FROM MSysObjects
WHERE (((MSysObjects.Type)=1) AND ((InStr(1,[Name],"MSys")=0)=True))
ORDER BY MSysObjects.Name;

To included Linked Tables:

SELECT MSysObjects.Name, IIf([Type]=6,"Yes","") AS Linked
FROM MSysObjects
WHERE (((MSysObjects.Type)=1 Or (MSysObjects.Type)=6) AND ((InStr(1,[Name],"MSys")=0)=True))
ORDER BY MSysObjects.Name;

mx
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 38325903
<*No Points wanted*>
You can revise the SQL MX posted to exclude system tables with something like this:

SELECT MSysObjects.Name
FROM MSysObjects
WHERE MSysObjects.Type=1 AND Left(MSysObjects.Name,4)<>"msys"
ORDER BY MSysObjects.Name;
0
 

Author Closing Comment

by:Buck_Beasom
ID: 38326619
Both your solutions were helpful!
0

Featured Post

Fill in the form and get your FREE NFR key NOW!

Veeam is happy to provide a FREE NFR server license to certified engineers, trainers, and bloggers.  It allows for the non‑production use of Veeam Agent for Microsoft Windows. This license is valid for five workstations and two servers.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
In a use case, a user needs to close an opened report by simply pressing the Escape (Esc) key. This can be done by adding macro code in Report_KeyPress or Report_KeyDown event.
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

807 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question