TableDef

G

Guest

I currently have a drop down listbox that displays a list of table name in
the database, but it will not display the tables that are linked to another
database.

Is there a way to do this?

Here is the code that I am currently using.

....
Dim dbs As DAO.Database, tdf As DAO.TableDef
Dim fld1 As DAO.Field
Dim rst As Recordset
Dim returnval
Dim strComboBox As String
Static Flds(100) As String

Forms!form1!Combo20.SetFocus
strComboBox = Combo20.Text
returnval = Null

Set dbs = CurrentDb
Set rstTemp = dbs.OpenRecordset("sysFieldNames", dbOpenDynaset)

Select Case CODE
Case acLBInitialize
For Each tdf In dbs.TableDefs
....


Thanks in advance!
 
D

Douglas J Steele

What's sysFieldNames: a table or a query?

If it's a query, what's the SQL?

If it's a table, how does it get populated?
 
G

Guest

Doug,

sysFieldNames is a table populated by the user selecting from a listbox.
Here is more of the code:

If tdf.Name = strComboBox Then
For Each fld1 In tdf.Fields
Flds(Entries) = fld1.Name
Entries = Entries + 1
With rstTemp
.AddNew
!ListFieldName = fld1.Name
.Update
End With
Next fld1
returnval = Entries
Exit For
End If

Thanks!

Dwight
 
D

Douglas J. Steele

You're making this difficult! <g>

Your original post says that your drop down listbox will not display the
tables that are linked to another database. Is the code you're showing part
of what populates that control? The code you just posted retrieves field
names, not table names.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top