My Code is:
Public Sub ImportCommonFields()
Set rs1 = CurrentDb.OpenRecordset("Imported Table" & " " & TableCtr)
Set cf = CurrentDb.OpenRecordset("CommonFields")
cf.AddNew
cf("FieldNames") = rs1.Fields
cf.Update
Set fld = Nothing
End Sub
I am currently getting the column names (Fields) from the table in rs1 and would like to import them to an existing table "CommonFields" under the column "FieldNames".
cffor each field inrs1? If that's the case then you need to loop over thers1fields and callcf.AddNewfor each field.