![]() |
ADO Recordset include Field names
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! |
ADO Recordset include Field names
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 -- Hope that helps. Vergel Adriano "Kirk P." wrote: 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! |
ADO Recordset include Field names
Perfect, thanks!
"Vergel Adriano" wrote: 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 -- Hope that helps. Vergel Adriano "Kirk P." wrote: 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! |
All times are GMT +1. The time now is 03:22 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com