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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Is it true, nobody knows this?

Status
Not open for further replies.

sunaj

Technical User
Feb 13, 2001
1,474
DK
I posted this question yesterday, but got no answers. Is it not possible?

I'm using ADO 2.5 in VB to create and search in a database.

I would like to ask the database the names of the tables and the name of the database. In MySQL this would be SHOW DATABASES and SHOW TABLES, but what is it in JET SQL or is there an ADO way to do it?

Thanks,
Sunaj
 
I don't know if this is what you are looking for or
not but I hope it helps.


Set catNew = New ADOX.Catalog

catNew.ActiveConnection = "Fred" ' ODBC Connection

For intLoop = 0 To catNew.Tables.Count - 1
msgbox catNew.Tables(intLoop).name
Next intLoop

Set catNew = Nothing


Richard
 
Hello,
This works in Access. I am too lazy too paste it into my VB6 compiler to test it.

Sub Test()
Dim t As TableDef

For Each t In CurrentDb.TableDefs
MsgBox t.Name
Next

MsgBox CurrentDb.Name
End Sub

Simply replace the Access built in CurrentDb keyword with the name of your database object. You should be able to modify this to accomplish your task. Rob Marriott
rob@career-connections.net
 
Thanks to rgh and CCTC1

I got it wotking with rgh's suggestion.
The .tables method also return several other objects (MSysACEs, MSysObjects, MSysQueries, MSysRelationships)

:) Sunaj
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top