newcoder54
Technical User
How do I extract a list of table field names and put them into a different table?
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
Public Function ListTableFields(tbl As String, Optional dbs As String)
Dim db As DAO.Database 'Database
Dim myTable As DAO.TableDef 'TableDef
Dim fld As DAO.Field 'Field
Dim x As Integer 'Count of fields
x = 0
If dbs = "" Then
Set db = CurrentDb
Else
Set db = OpenDatabase(dbs)
End If
Set myTable = db.TableDefs(tbl)
x = myTable.Fields.Count
With myTable
For Each fld In .Fields
Debug.Print " " & fld.Name
Next fld
End With
End Function
How do I extract a list of table field names and put them into a different table?
Melagan - my apologies, I misread that statement.newcoder54 said:field names from a table that it created from a crosstab query
=== quniResults ===
SELECT MyDate FROM test1
UNION
SELECT "REPNAME" FROM test1
UNION
SELECT "Total Of Minutes" FROM test1;
============
Then use this union query in an append or make table query.