Never mind; problem solved. It was a read permission issue. To get around
it, I had to open the database, select the Tools / Options menu command
and on the General tab, check "System Objects" in the Show group. Then I
chose Tools / Security / User and Group permisssions, and select the now
visible MSysObjects table and check "Read Data."

Now MapBasic can open this table and see what tables are in the Access 
database. You can do it directly like so:

Dim sDB As String
  Close All
  sDB = ApplicationDirectory$()+"Sample.mdb"
  Register Table sDB Type "Access" Table "MSysObjects"
    Into ApplicationDirectory$()+"test.tab"
  Open Table ApplicationDirectory$()+"test.tab" As TEST
  Select Name From TEST where Type = 1 into TABS
  Browse * from TABS

or you can use ODBC like so:

Server Link Table "SELECT Name FROM MSysObjects WHERE Type=1;"
Using "DSN=MS Access Database;DBQ=c:\tmp\sample.mdb;UID=ADMIN"
toolkit "ODBC"
Into "Test" File "C:\My Documents\Test.TAB"

(be sure to close the server connection when you're done.)

There must still be another way to list tables in an Access databse even 
if read permission on MSysObjects is turned off, because the MapInfo 
interface to Access can do it. But if that's not done through some API 
accessible to MapBasic, then I guess the above method will work as long as 
you set the permissions first.

- Bill Thoen





---------------------------------------------------------------------
List hosting provided by Directions Magazine | www.directionsmag.com |
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Message number: 15433

Reply via email to