Try this test.
Dim fieldcount as integer
and then after Set Atd = CurrentDb.OpenRecordset(sql2)
Atd.movefirst
With Atd
For fieldcount = 1 To 5 'you need to change this to the actual number of fields that you have in
msgbox .Fields(fieldcount).name
next fieldcount
end with
This should provide a msgbox for each field and give it's name.
But if you create a query and Link to it from Excel or copy it to Excel it should include the Heading titles, doesn't it do that?
Dim fieldcount as integer
and then after Set Atd = CurrentDb.OpenRecordset(sql2)
Atd.movefirst
With Atd
For fieldcount = 1 To 5 'you need to change this to the actual number of fields that you have in
msgbox .Fields(fieldcount).name
next fieldcount
end with
This should provide a msgbox for each field and give it's name.
But if you create a query and Link to it from Excel or copy it to Excel it should include the Heading titles, doesn't it do that?