afwasborstel
02-28-2004, 10:58 AM
I was wondering if there is a way to get the tablenames from a database. The way I do it now is that I make a table wich contains the tablenames, eg...I make a new table and I write the tablename in to a table wich contains all table names. Then I can use that table to fill a combobox. I think there must be a quicker way to do this....anyone???
MKoslof
02-29-2004, 10:10 AM
What database type are you using (Access, SQL Server, Oracle, etc.) There are several potential methods for getting all the table names within a database. Let us know what database engine you are using and we can provide the best solutions...
afwasborstel
02-29-2004, 04:44 PM
I use a Acces database...with MS-jet 4.0 and an Oledb connection..
randem
03-01-2004, 09:03 PM
afwasborstel
Here is a start, it works on all databases. This has some Access specific code in it.
Set c_rs = dbcon.OpenSchema(adSchemaTables, Array(Empty, Empty, Empty, "TABLE"))
If Not c_rs.EOF Then
While Not c_rs.EOF
If Left(c_rs!TABLE_NAME, 4) <> "MSys" Then ' just in case of Access 97
ReDim Preserve c_tNames(c_tCount)
c_tNames(c_tCount) = c_rs!TABLE_NAME
c_tCount = c_tCount + 1
End If
c_rs.MoveNext
Wend
End If