Hi Steve,
Not sure I've got your true meaning, so I've waited for the NG, but in the
absence of replies ...
When you say "header row", do you mean: as though you were about to create
an export file?
In that case, you would want something like:
"Cust Id", "Company name", "Contact Surname", "Contact Forename" ....
You could write a small loop to concatenate each of your 60 rows into that
type of string.
Alternatively, you might mean that you have a table with 60 rows of a single
column and another table with 60 columns into which you wish to port the
data. Again that's a small loop.
On the other hand, you might have something completely different in mind?
CD
.... sample code completely untested
Function Built_Export_Header$
Dim wk$, q$, sep$, rs As DAO.Recordset
q$ = Chr(34)
sep$ = ", "
wk$ = ""
Set rs = CurrentDb.OpenRecordset("SourceTable",dbOpenDynaset)
Do
If rs.EOF Then Exit Do
wk$ = wk$ & sep$ & q$ & rs![SourceColumnName] & q$
' *^* resultant syntax fault if embedded quote exists in column
data content
' ... should really call a quote_protect function to ensure that
can't happen
rs.MoveNext
Loop
Set rs = Nothing
Built_Export_Header$ = Mid$(wk$,Len(sep$)+1)
End Sub
Function Pivot_Col_to_Row
Dim rsS As DAO.Recordset, rsD As DAO.Recordset
Dim i%
Set rsS = CurrentDb.OpenRecordset("SourceTable",dbOpenDynaset)
Set rsD = CurrentDb.OpenRecordset("DestinationTable",dbOpenDynaset)
i = 0 : rsD.AddNew ' open up new, empty record
Do
If rsS.EOF Then Exit Do
rsD(i) = rsS![SourceColumnName]
i = i+1
rsS.MoveNext
Loop
rsD.Update
Set rsS = Nothing
Set rsD = Nothing
End Sub