View Single Post
  #12   Report Post  
Posted to microsoft.public.excel.programming
nate axtell nate axtell is offline
external usenet poster
 
Posts: 12
Default adodb.recordset with excel

Dick,
The only place I've seen this occur is when I resize a column in Excel.
Excel will then
show a Sci. Not. version of the number because of the reduced space. When I
loop
through the recordset and then display the row I see the Sci. Not.:

XLrs.MoveFirst
while not XLrs.eof
Dim k: k = 0
Dim strT, ColumnField
strT = ""
For each ColumnField in XLrs.Fields
strT = strT & XLrs(SelectionValue(k)).value & " , "
k = k + 1
next
msgbox strT
XLrs.movenext
wend

Unless the recordset is changing the number, which I have never seen before,
I would
say that Excel is passing over the Sci. Not. version of the number which the
recordset
is then converting to text instead of translating back to its normal number
representation.

Note that I still have "Number" fields in my Excel file; there are still
mixed text and
numbers. If I select the Sheet contents and change the format to text this
only changes
the way numbers appear in their cells, not what they actually are. If I
then double-click
on a cell then the number will be saved as text. I even confirmed this when
I found the
following article: http://support.microsoft.com/?id=194124 (see resolution
1).
If I do double-click on the 'Long' number field and click away, the number
will be saved
as text. Then from here the number will show up in its normal format
because Excel thinks
of it as a text cell (these cells show a green triangle in the upper left
corner).

Because of this I think that Excel is the culprit. The recordset is just an
ADODB.Recordset,
nothing special that would convert numbers to sci. not. The value received
depends on
the data format in Excel.

I wonder if this has ever been seen before. I'm still trying to figure out
what to do with
TypeGuessRows in the registry since I can't edit the registry to set it to
0. I just know
someone will come up with the case where they have the first eight rows as
numbers
and then they will throw a text field in somewhere after that. The IMEX was
a big help
though.
Thanks,
Nate

"Dick Kusleika" wrote in message
...
Nate

That's odd. When .CopyFromRecordset into another workbook, the number

comes
through fine. Also, when I loop through the records and fields and print
the .Value property to the Immediate Window, it comes through fine.

What makes you think Excel is doing it?

--
Dick Kusleika
MVP - Excel
Excel Blog - Daily Dose of Excel
www.dicks-blog.com