How to include field name in CopyFromRecordset

  • Thread starter Thread starter clara
  • Start date Start date
C

clara

Hi all,

When I dump the record onto a sheet, I hope to include the fields' name from
the recordset. How can I do it?

Shu Zi Yang
 
Can't.

Loop through the fields and stick the names above the recordset.

Dim nFieldIndex as Long
For nFieldIndex = 0 to rs.Fields.Count - 1
Cells(1, 1+nFieldIndex).Value = rs.Fields(nFieldIndex ).Name
Next
 
Hi Tim,

If I want to chage some fields from number to descriptive string, how can I
do it when I use CopyFromRecordset. For example, in filed Serverity 1 means
"Low"; 2 means "Medium"

Clara
 
The query/stored proc should do it, IMO. I suppose you could perform a
find/replace to the results but my preference is to keep the logic in 1
place.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top