Listing table names

sconly

Registered User.
Local time
Today, 06:21
Joined
Oct 8, 2002
Messages
56
is it possible to list the tablenames from a database in a listbox/combobox on a form in another database ?

if so, HOW??

Matt
 
You can get table names from the MSysObjects system table (usually hidden), and use the following SQL syntax to access an external database.

Code:
Private Sub Form_Load()
  Dim sSql as String
  sSql = "SELECT [Name] " & _
      "FROM MSysObjects IN 'C:\someother.mdb' " & _
      "WHERE Type=1 and Flags=0 " & _
      "ORDER BY [Name];"
  Combo0.RowSource = sSql
End Sub

This example assumes that the external database doesn't have passwords or login details.
 
just what i was after. CHEERS!

next thing.

how do i open a form 'frmSearched' with the details of the table i selected from the combobox ?

Matt
 
sorry i meant the records/data, ie. name address ,etc

Matt
 
Do you know the structure of each external table in advance?

Are you going to open one form that could potentially display many different tables, or will you have diffent forms for each table?
 

Users who are viewing this thread

Back
Top Bottom