ADO Recordset include Field names

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

How do I modify this code to get the Field names from rec6 to start in column
13? They currently start in column 1, and I've tried modifying it several
ways - so far no luck.

For nCol = 1 To rec6.Fields.Count
Sheets("ACN").Cells(7, nCol).Value = rec6.Fields(nCol - 1).Name
Next nCol
Sheets("ACN").Cells(8, 13).CopyFromRecordset rec6

Thanks!
 
try it this way:

For nCol = 1 To rec6.Fields.Count
Sheets("ACN").Cells(7, nCol+12).Value = rec6.Fields(nCol - 1).Name
Next nCol
Sheets("ACN").Cells(8, 13).CopyFromRecordset rec6
 
Perfect, thanks!

Vergel Adriano said:
try it this way:

For nCol = 1 To rec6.Fields.Count
Sheets("ACN").Cells(7, nCol+12).Value = rec6.Fields(nCol - 1).Name
Next nCol
Sheets("ACN").Cells(8, 13).CopyFromRecordset rec6
 

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

Similar Threads


Back
Top