I'm trying to get a list of fields in one table and create a new table with those fields.
In a big picture - I'm working on a macro that will process data imported to the access db.
I want to have a form that user can manually map the imported table fields to a table template and run macro that will process all data.
So I thought I will create a form where user could pick specific imported table fields and map it to template which will be processed later on.
This is why I need to get all fields from imported table in a new table, which I will display in drop-down list on the form for user to map.
I hope that makes sense.
So far, finding different vba codes for similar jobs, I got this.
It gives me a list of fields, but I don't know how to create a table from those...
Please help me to get them in a table
In a big picture - I'm working on a macro that will process data imported to the access db.
I want to have a form that user can manually map the imported table fields to a table template and run macro that will process all data.
So I thought I will create a form where user could pick specific imported table fields and map it to template which will be processed later on.
This is why I need to get all fields from imported table in a new table, which I will display in drop-down list on the form for user to map.
I hope that makes sense.
So far, finding different vba codes for similar jobs, I got this.
It gives me a list of fields, but I don't know how to create a table from those...
Please help me to get them in a table

Code:
Function listTblFlds() As String
On Error GoTo Error_Handler
Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim sSQL As String
Dim fld As Field
Dim tTable As String
Set db = CurrentDb()
tTable = "Table1"
sSQL = "SELECT *" & _
" FROM [" & tTable & "]" & _
" WHERE (False);"
Set rs = db.OpenRecordset(sSQL, dbOpenSnapshot)
For Each fld In rs.Fields 'loop through all the fields of the tables
Debug.Print fld.Name
Next
Error_Handler_Exit:
On Error Resume Next
rs.Close
Set rs = Nothing
Set db = Nothing
Exit Function
Error_Handler:
MsgBox "The following error has occurred" & vbCrLf & vbCrLf & _
"Error Number: " & Err.Number & vbCrLf & _
"Error Source: listTblFlds" & vbCrLf & _
"Error Description: " & Err.Description _
, vbOKOnly + vbCritical, "An Error has Occurred!"
Resume Error_Handler_Exit
End Function