LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 599
Default ADO inserts text strings not numbers when table is empty


"onedaywhen" wrote in message
om...
Dick,
I re-tested myself and kept getting mixed results. Sometimes I got the
apostrophe ('3), other times not (just 3). So I dug deeper...

I conclude the INT function indeed makes no difference. However, how
the worksheet was created seems to make a difference.


Interesting. So if you identify the data type in CREATE TABLE, it will
work. I've never created a table using CREATE TABLE, so that's a new one on
me. I wonder if there's any way to define the data type in a manually
created table.

I know that ADO has a tendency to inherit the data type from the previous
row. Instead of Col1 and Col2, I made my headings 1234 and 5678, but I
couldn't get the SQL to read it as a column heading. It appears that column
headings have to be strings.

When I did an INSERT INTO using

stSQL = "Insert Into [Sheet2$] (1234) values (8)"

(after changing my heading to '1234) it put in 8 as '8. When I replaced it
with a numeric 8, future INSERT INTOs showed as numeric, not strings.

Next, I deleted all the rows of the table (sans header) and formatted Row 2
of the sheet as a number data type just using cell formatting. I didn't
enter anything into the cells in Row 2. The I hid Row 2. When I ran the
INSERT INTO again, it came in as numeric. So maybe for setting up tables
manually, you define the data type a cell format in the first row, hide it,
and everything's keen.

Dick


 
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
find and replace numeric strings in larger text strings Mr Molio Excel Worksheet Functions 8 November 9th 11 05:17 PM
Empty strings appear as zeros Paul Martin[_2_] Charts and Charting in Excel 5 May 9th 08 12:37 AM
How can I convert empty strings to empty cells? Shane Excel Discussion (Misc queries) 2 July 19th 05 12:10 PM
2 more questions about extracting numbers from text strings andy from maine Excel Discussion (Misc queries) 0 March 28th 05 09:47 PM
Clear Empty Strings Tim Tabor Excel Programming 3 October 6th 03 02:12 AM


All times are GMT +1. The time now is 02:58 PM.

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"