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: 2
Default Problem writing numbers and dates to spreadsheet using ADO

When I write numbers, dates or currency values to an Excel file using
ADO (VB6) there is a little green mark at the top left of each column
indicating there is an error with the data. When I click on the cell I
get a small exclamation mark pops up to the left. I click on it and it
shows a drop down which provides the following selections:
"Number Stored as Text"
"Convert to Number"
"Help on this Error"
"Ignore Error:"
"Edit in Formula Bar"
"Error Checking Options"
"Show Formula Auditing Toolbar"

Apparently Excel thinks there is a problem with the data. But all I
have to do to correct the problem and get rid of the little green mark
at the top left corner of the cell is click in the formula bar and the
click out. So there really isn't a problem (the cell is formated as
"General" so numbers or dates should work as well as anything else).
Here is the code I use.

With objConn
.Provider = "Microsoft.Jet.OLEDB.4.0"
.ConnectionString = "Data Source=" & strExcelFile & "; Extended
Properties=Excel 8.0"
.Open
End With

rs.Open "select * from [Sheet1$]", objConn, adOpenKeyset,
adLockOptimistic

mrsPrepaidQuotes.MoveFirst ' mrsPrepaidQuotes is an ado recordset
from a mssql2000 db
While Not mrsPrepaidQuotes.EOF
rs.AddNew
rs.Fields("OriginalOrderDate") = DateOnly(mrsPrepaidQuotes!
OriginalOrderDate) 'returns a data string "07/07/2006" - Has the
little green thing in corner
rs.Fields("OriginalS#") =
mrsPrepaidQuotes.Fields("OriginalS#").Value ' returns a letter and
numbers ' no prob
rs.Fields("Quote#") = mrsPrepaidQuotes.Fields("Quote#").Value '
returns a letter and numbers ' no prob
rs.Fields("CustomerNumber") =
mrsPrepaidQuotes.Fields("CustomerNumber").Value ' returns a number, as
green thing
rs.Fields("Amt") = FormatCurrency(mrsPrepaidQuotes!Amt) ' return
currency string "$100.00" also has green thing
rs.Fields("Amt w/Tax") =
FormatCurrency(mrsPrepaidQuotes.Fields("Amt w/Tax").Value) return
currency string "$100.00" also has green thing
mrsPrepaidQuotes.MoveNext
Wend
rs.Update

Thanks in advance.

 
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
Writing a macro that will exit a spreadsheet Dave Doc New Users to Excel 2 January 26th 06 01:41 PM
VBA UDF Writing data to spreadsheet Macroman Excel Programming 4 April 17th 05 10:51 AM
Writing Out Numbers as Text [email protected] Excel Programming 1 October 11th 04 09:35 PM
Writing bitmap to Excel Spreadsheet Macca Excel Programming 0 September 21st 04 02:41 PM
Writing to a excel spreadsheet is slow. Pat Lenahan Excel Programming 5 November 19th 03 08:33 PM


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