Originally posted by: larva
Hi Beau6183,
Thanks a lot for your info. How about if I wanna display all the tables name available in my database into the listbox ? Thank you !
regards,
Larva
What kind of database are you using? Are you using SQL connectivity or ADO? If you are using ADO, it does not support table cataloging. The only way to do this is to create another table that acts as a list of the existing tables -- you'll have to input this data and keep it updated. However, SQL does support cataloging:
'---|| SQL Table Catalog ||---
'--- Create an instance of the SQL Server Connection ---
Dim OServer, oSQLdb as Object
Set OServer = CreateObject("sqlole.sqlserver")
OServer.Connect "MyServerName", "MyUserID", "MyPassword"
'--- Connect to the specific database on the SQL Server ---
Set oSQLdb = oServer.Databases(MyDatabaseName)
'--- Loop through each table name and assign the value to a listbox (list1) ---
Dim objTable, i
i = 0
For Each objTable in oSQLdb.Tables
List1.AddItem objTable.Name, i
i = i + 1
Next