Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Return a list of tables in an MDB

Status
Not open for further replies.

Neil Toulouse

Programmer
Joined
Mar 18, 2002
Messages
882
Location
GB
Hi there!

Can anyone tell me if there is a way of returning a list of tables in an MDB using SQL-Passthru?

Basically I am using Visual FoxPro and have connected to the MDB via ODBC and need to retrieve (to a cursor) a list of tables within the MDB.

TIA
Neil "I love work. I can sit and stare at it for hours..."
 
SELECT MSysObjects.Name FROM MsysObjects WHERE (Left$([Name],4) <> &quot;Msys&quot;) AND (MSysObjects.Type)=1 ORDER BY MSysObjects.Name
 
Many thanks for the response! You'll have to excuse my ignorance as I have never used Access.

Unfortunately, when I run your command am I getting an ODBC error which states:

Record(s) cannot be read; no read permissions on 'MSysObjects'

Is this an ODBC thing or an Access thing?

TIA
Neil &quot;I love work. I can sit and stare at it for hours...&quot;
 
I have now been told to use the SQL passthru statements SQLTABLES() AND SQLCOLUMNS() to get my result.

Thanks
Neil &quot;I love work. I can sit and stare at it for hours...&quot;
 
In access, open your database, hit the tools menu and select options.

In the &quot;view&quot; tab make sure that &quot;system objects&quot; is checked.

You should now see about five new tables including &quot;MsysObjects&quot;.

Now you should be able to run the Query posted by gof4

I hope this is helpful.
Ed
 
Ues this;
SELECT MSysObjects.ForeignName
FROM MSysObjects
WHERE (((MSysObjects.ForeignName) Is Not Null));
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top