I am trying to concatenate field names (separated by a comma or some of the delimiter) and write them to record in my database, or store them as a string that I can use in an expression later on. So far I have code that pulls all the field names from a query and writes them to the debug window. But I am stuck after that. I can't figure out how to get the output into another format. Any suggestions would be appreciated.
Code:
Sub Fieldnames()
Dim Rst As Recordset
Dim db As Database
Dim f As Field
Dim qdfParmQry As QueryDef
Set db = CurrentDb()
Set qdfParmQry = db.QueryDefs("qry_1test")
qdfParmQry("Forms!Occu_formatting!Species") = [Forms]![Occu_formatting]![Species]
Set Rst = qdfParmQry.OpenRecordset()
For Each f In Rst.Fields
Debug.Print f.Name
Next
Rst.Close
End Sub
Comment