PC Review


Reply
Thread Tools Rate Thread

copying field names from Access query

 
 
mike.wilson8@comcast.net
Guest
Posts: n/a
 
      16th Oct 2006
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 With Quote
 
 
 
 
Dave Patrick
Guest
Posts: n/a
 
      16th Oct 2006
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

<(E-Mail Removed)> 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 With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Access 2007 query returning field names rather than alias Dale Fye Microsoft Access Queries 6 1st Dec 2011 12:12 AM
Access 2007 not showing field names in query wizard/lookup wizard/etc bobrich@gmail.com Microsoft Access 0 15th Jul 2007 11:06 PM
query to retrieve list of field names belonging to an access table =?Utf-8?B?TG9ycmFpbmU=?= Microsoft Access Queries 3 9th Aug 2005 12:19 PM
?prevent MS query from changing the * to field names of Access tabls? timwang TM via AccessMonster.com Microsoft Access External Data 0 19th Jan 2005 07:56 AM
Re: Field names used in query get changed by Access to incorrect values al Microsoft Access Queries 1 23rd Jul 2003 06:19 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 05:22 AM.