I have listed the table names and the the field name for each of the tables out using msgbox(). I have also created a new table def and i was wondering how i could go about writing this data into the table i created in the form:
table1:field 1
table1:field 2
: :
: :
table1:Field n
table2:Field 1
: :
tablen:Field n
Here is the code i a using:
Sub list_fields()
Dim list_field As DAO.Field
Dim tbl As DAO.TableDef
Dim db As DAO.Database
Set db = CurrentDb
Set tbl = db.CreateTableDef("tbl List Fields")
For Each tbl In DBEngine.Workspaces(0).Databases(0).TableDefs
MsgBox (tbl.Name)
For Each list_field In DBEngine.Workspaces(0).Databases(0).TableDefs("tbl_value").Fields
MsgBox (loopy.Name)
Next
Next
End Sub
table1:field 1
table1:field 2
: :
: :
table1:Field n
table2:Field 1
: :
tablen:Field n
Here is the code i a using:
Sub list_fields()
Dim list_field As DAO.Field
Dim tbl As DAO.TableDef
Dim db As DAO.Database
Set db = CurrentDb
Set tbl = db.CreateTableDef("tbl List Fields")
For Each tbl In DBEngine.Workspaces(0).Databases(0).TableDefs
MsgBox (tbl.Name)
For Each list_field In DBEngine.Workspaces(0).Databases(0).TableDefs("tbl_value").Fields
MsgBox (loopy.Name)
Next
Next
End Sub