load tables from different database

tomro1

Registered User.
Local time
Today, 14:22
Joined
Jun 12, 2006
Messages
23
hi,

This is the code that i used to get my tablenames into a combobox:

Dim STRtables As String
Dim obj, obj1 As AccessObject, dbs As Object
Set dbs = Application.CurrentData
For Each obj In dbs.AllTables
If STRtables = "" Then
STRtables = obj.Name
Else
STRtables = STRtables + ";" + obj.Name
End If
Next obj
combobox.RowSource = STRtables


Now i need to get into the combobox, the tables from a different database, so that i can see what tables there are in another database.
can anyone help me find out how i can do this?

thanks in advance
 
t,

You can use the mSysObjects table in either database to get a list of the tables.

For the external DB:

Code:
Select Name
From   mSysObjects In 'C:\SomeDatabase.mdb'
Where Type In (1, 2, ...) <-- Don't know off-hand, you'll have to research

I posted a sample database "MDB Comparison", it has a few examples of working
with tables in an external DB.

Wayne
 

Users who are viewing this thread

Back
Top Bottom