LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default copyFromRecordset - vs - getRows

I'm extracting external numeric data from tables where the field type is
defined as a fixed length string (ie there are extra spaces in the field if
the length of the number is less than the field size).

Using ADO and the getRows method of a recordset to pass the results to an
array before populating the range in the worksheet results in the strings
being automatically converted to a number (except for entries that are
definitely strings, such as all spaces of na etc).

That was a feature of the .value method of a range I was pleasantly
surprised by.

However, if I use the .copyFromRecordset to pass the results directly to a
range, the string for each number is written to each cell (eg "4.5 "
instead of 4.5 that happens when using .value)

My knowledge of SQL is limited, and I can't see anything in the recordset
property that would allow for converting the type of the retrieved data
from strings to numerics (really - just trimming the data of whitespace).

my current workarround is to write the data with .copyFromRecordset, read
the data back into an array and write it out immediately.

Is it possible to avoid that last step either with some SQL or something in
ADO that I've missed?

cheers,
Christophe


 
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
CopyFromRecordset Ernst Guckel[_4_] Excel Programming 3 May 1st 05 08:03 PM
Can't assign to Array .GetRows in Excel 97 Lenn Excel Programming 2 June 24th 04 02:30 AM
Can't assign to Array .GetRows in Excel 97 Lenn Excel Programming 0 June 24th 04 12:58 AM
ADO slow recordset getrows RB Smissaert Excel Programming 4 August 10th 03 08:22 PM
Copyfromrecordset Bug ? news.btx.dtag.de Excel Programming 1 August 1st 03 07:44 PM


All times are GMT +1. The time now is 11:00 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"