Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 20
Default copying field names from Access query

In the code below, the field names from the query start on row 9, col
A. How do I tweak the code to where the field name header section
starts on row 9, col F?


Set qry = db.QueryDefs("Q-PRE_ENDTOEND_CROSSTAB BY DAY")
Set rec = qry.OpenRecordset
Sheets("Sheet1").[f10].CopyFromRecordset rec

' Set up column headers with field names
For i = 0 To rec.Fields.Count - 1
Cells(9, i + 1).Value = rec.Fields(i).Name
' Cells(9, i + 1).Font.Bold = True

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 249
Default copying field names from Access query

Change + 1 to + 6

--

Regards,

Dave Patrick ....Please no email replies - reply in newsgroup.
Microsoft Certified Professional
Microsoft MVP [Windows]
http://www.microsoft.com/protect

wrote:
| In the code below, the field names from the query start on row 9, col
| A. How do I tweak the code to where the field name header section
| starts on row 9, col F?
|
|
| Set qry = db.QueryDefs("Q-PRE_ENDTOEND_CROSSTAB BY DAY")
| Set rec = qry.OpenRecordset
| Sheets("Sheet1").[f10].CopyFromRecordset rec
|
| ' Set up column headers with field names
| For i = 0 To rec.Fields.Count - 1
| Cells(9, i + 1).Value = rec.Fields(i).Name
| ' Cells(9, i + 1).Font.Bold = True
|


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Rename imported MS Access field names Ron Excel Discussion (Misc queries) 1 May 7th 09 05:17 PM
Retreiving list of table & field names from Access into Excel using VBA shivboy[_5_] Excel Programming 4 June 15th 06 08:09 AM
Excel Spreadsheet from Access. List of names changes as names are Gordy w/Hi Expectations Excel Discussion (Misc queries) 1 October 21st 05 03:30 AM
Opening ,copying, access query resultsfrom Excel Danail Excel Programming 1 March 28th 05 12:17 AM
DAO query/recordset returns with field names Seth[_4_] Excel Programming 0 August 18th 03 08:36 PM


All times are GMT +1. The time now is 08:52 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"