Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 252
Default How to include field name in CopyFromRecordset

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
--
thank you so much for your help
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 389
Default How to include field name in CopyFromRecordset

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


--
Tim Zych
SF, CA

"clara" wrote in message
...
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
--
thank you so much for your help



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 252
Default How to include field name in CopyFromRecordset

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
--
thank you so much for your help


"Tim Zych" wrote:

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


--
Tim Zych
SF, CA

"clara" wrote in message
...
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
--
thank you so much for your help




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 389
Default How to include field name in CopyFromRecordset

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.

--
Tim Zych
SF, CA

"clara" wrote in message
...
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
--
thank you so much for your help


"Tim Zych" wrote:

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


--
Tim Zych
SF, CA

"clara" wrote in message
...
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
--
thank you so much for your help






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
Include a Picture Field JethroUK© New Users to Excel 3 October 13th 07 06:32 AM
ADO Recordset include Field names Kirk P. Excel Programming 2 April 18th 07 09:08 PM
Code to include a one-up suffix to a field value Doctorjones_md Excel Discussion (Misc queries) 4 January 4th 07 06:18 PM
Limit to field size with .CopyFromRecordset Jeff M Excel Programming 2 August 22nd 06 07:10 AM
Excel 2003 SP1: CopyFromRecordset error if field above 911 charact Nathan Holmes Excel Programming 0 February 6th 06 09:35 PM


All times are GMT +1. The time now is 12:02 AM.

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

About Us

"It's about Microsoft Excel"