View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Rob Bovey Rob Bovey is offline
external usenet poster
 
Posts: 811
Default ado problem in excel


Here are a couple of suggestions. If you use the Range.CopyFromRecordset
method to retrieve your data then any Null values will be handled
automatically. If you need to retrieve string values directly, the typical
way to handle that is something like the following:

Dim lValue As Long
If IsNull(rsData.Fields(0).Value) Then
lValue = 0
Else
lValue = rsData.Fields(0).Value
End If

You could also rewrite your SQL statement to replace nulls with zero so that
you don't have the problem to begin with.

--
Rob Bovey, MCSE, MCSD, Excel MVP
Application Professionals
http://www.appspro.com/

* Please post all replies to this newsgroup *
* I delete all unsolicited e-mail responses *


"Goh Siang Hwee" wrote in message
...
I am facing some problem in ado recordset when i tried to
retrieve data which is numeric and it return null finally.

I change the field datatype to text afterward and reenter,
it seems no problem. but now the there are a lot of data
inserted using the old excel file. It is possible for me
to get the numeric data for excel thru visual basic 6.