oAcc = CREATEOBJECT("Access.Application") lcmdb=GETFILE('mdb') oAcc.OpenCurrentDatabase(lcmdb) LOCAL lnTables lnTables = oAcc.CurrentData.AllTables.Count FOR i = 1 TO lntables lctable=oacc.CurrentData.AllTables(i).name IF OCCURS('MSys',lctable)=0 ?lctable endif endfor
John
-----Original Message----- From: profox-bounces .at. leafe D.OT com [mailto:profox-bounces@leafe.com] On Behalf Of Paul Newton Sent: Wednesday, January 31, 2007 5:13 PM To: profox .at. leafe D.OT com Subject: Access automation
Hi all
I am trying to get a list of tables in an MS Access MDB and what I have so far is
oAcc = CREATEOBJECT("Access.Application" oAcc.OpenCurrentDatabase("MyDatabase.MDB") LOCAL lnTables lnTables = oAcc.CurrentData.AllTables.Count
This returns a value of 9 for lnTables but the MDB only contains 2 (user) tables - the rest are apparently system tables whose names all begin with MSys.
How can I get a count/list of the tables excluding the system tables (without iterating all of them to exclude the system tables) ?
Thanks
PS What I am eventually trying to do is give the user a choice of tables and then use the Access Export functionality to create a DBF(s). I have done this before using ADODB and the Microsoft.Jet.OLEDB provider but would like to try this different approach.
[excessive quoting removed by server]
©2007 john harvey |