LosBear
asked on
List TableNames from MS Access DB
Once I'm connected, what's the SQL statement (or....???) to list into a recordset/array the names of all the tables in the database? I need the list from a MS Access file (*.mdb) -I'm doing this in VB6
Thx in advance.
Thx in advance.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
You should also take a look at OpenSchema : http://support.microsoft.com/default.aspx?scid=kb;en-us;186246
Dim db as Database, td as TabDef
SET db = DBEngine.OpenDatabase("ful l db path name")
FOR Each td IN db.TableDefs
'td.Name is here. Add to ListBox or whatever
NEXT
END SUB
SET db = DBEngine.OpenDatabase("ful
FOR Each td IN db.TableDefs
'td.Name is here. Add to ListBox or whatever
NEXT
END SUB
ASKER
thanks for your help guys -
I followed aelatik's link and saw the crap everyone posted: here's the simplified version for the next guy who comes around:
objConn.Open "Provider=Microsoft.Jet.OL EDB.4.0;Da ta Source=c:\file.mdb"
Set RS = objConn.OpenSchema(adSchem aTables)
Do Until RS.EOF
strTableName = RS("TABLE_NAME")
Combo1.AddItem strTableName
RS.MoveNext
Loop
I'm awarding the points to aelatik 'cause he was first; but thanks for all your help
Catcha l8r
Bear
I followed aelatik's link and saw the crap everyone posted: here's the simplified version for the next guy who comes around:
objConn.Open "Provider=Microsoft.Jet.OL
Set RS = objConn.OpenSchema(adSchem
Do Until RS.EOF
strTableName = RS("TABLE_NAME")
Combo1.AddItem strTableName
RS.MoveNext
Loop
I'm awarding the points to aelatik 'cause he was first; but thanks for all your help
Catcha l8r
Bear
FROM MSysObjects
WHERE (((MSysObjects.Name) Not Like "MSys*") AND ((MSysObjects.Type)=1));
Good Luck!