Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
DEI DEI is offline
external usenet poster
 
Posts: 7
Default Null to Zero from External Data

I am new to Access programming, but am familiar with Access programming.

I have a range of cells linked to a Query in Access that produces null
values. I used the the Nz function in Access to convert the null values to
"0" (Ex. Nz([DISCHARGES],0,[DISCHARGES]), but when I refresh the data in
Excel, Excel does not recognize the Nz function.

I tried to write a n If statement into the SQL statement, which accomplishes
the same thing on the Access side, but then when I refresh in Excel, I get a
message saying "too few parameters".

I need for the empty cells to convert to zero for use in functions that
display averages over time.

What is the best way to deal with this? Write code that replaces the empty
cells with zeros? If so, where would I put it?

Thanks in advance.

DEI
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Null to Zero from External Data

http://support.microsoft.com/support.../q182/7/35.asp
XL97: How to Use the Query Before and AfterRefresh Events

--
Regards,
Tom Ogilvy


"DEI" wrote in message
...
I am new to Access programming, but am familiar with Access programming.

I have a range of cells linked to a Query in Access that produces null
values. I used the the Nz function in Access to convert the null values

to
"0" (Ex. Nz([DISCHARGES],0,[DISCHARGES]), but when I refresh the data in
Excel, Excel does not recognize the Nz function.

I tried to write a n If statement into the SQL statement, which

accomplishes
the same thing on the Access side, but then when I refresh in Excel, I get

a
message saying "too few parameters".

I need for the empty cells to convert to zero for use in functions that
display averages over time.

What is the best way to deal with this? Write code that replaces the

empty
cells with zeros? If so, where would I put it?

Thanks in advance.

DEI



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 279
Default Null to Zero from External Data

Please provide more code specifics.

You mention Excel and Access ..
then refresh in Excel causing issues.....
Nz should work so the issue is somewhere in your process...

"DEI" wrote:

I am new to Access programming, but am familiar with Access programming.

I have a range of cells linked to a Query in Access that produces null
values. I used the the Nz function in Access to convert the null values to
"0" (Ex. Nz([DISCHARGES],0,[DISCHARGES]), but when I refresh the data in
Excel, Excel does not recognize the Nz function.

I tried to write a n If statement into the SQL statement, which accomplishes
the same thing on the Access side, but then when I refresh in Excel, I get a
message saying "too few parameters".

I need for the empty cells to convert to zero for use in functions that
display averages over time.

What is the best way to deal with this? Write code that replaces the empty
cells with zeros? If so, where would I put it?

Thanks in advance.

DEI

  #4   Report Post  
Posted to microsoft.public.excel.programming
DEI DEI is offline
external usenet poster
 
Posts: 7
Default Null to Zero from External Data

Sorry for being unclear, I meant to say I am new to EXCEL programming and
familiar with Access programming.

Basically, EXCEL does not recognize the Nz functiion I used in the SQL
statement of the query it is fetching from Access; I need the empty cells to
appear as zeros. The Nz function is a simple function in Access that, when
it encounters a null value, converts it to whatever you specify, ex:
Nz([total],"-") produces a "-" when the total is null.

What I eventually did was add the following code to the Change event, so it
will run after the data is refreshed. I suppose the AfterRefresh event will
work even better:

'-Code converts null values to a zero for a specific range if
cells...determined by
'-which cells already have data.

Dim rc As Long

rc =
Application.WorksheetFunction.CountIf(Workbooks("O CT-2005").Worksheets(8).Range("N7:N38"), "<")

With Workbooks("OCT-2005").Worksheets(8)
'.Range("L7:M" & 6 + rc).Replace What:=Null, Replacement:="0"

End With

This a limitatiion in automating Excel with Access, unless there is
something in Excel designed to handle blank fields, etc.

Thanks for your replies.

DEI





"Tom Ogilvy" wrote:

http://support.microsoft.com/support.../q182/7/35.asp
XL97: How to Use the Query Before and AfterRefresh Events

--
Regards,
Tom Ogilvy


"DEI" wrote in message
...
I am new to Access programming, but am familiar with Access programming.

I have a range of cells linked to a Query in Access that produces null
values. I used the the Nz function in Access to convert the null values

to
"0" (Ex. Nz([DISCHARGES],0,[DISCHARGES]), but when I refresh the data in
Excel, Excel does not recognize the Nz function.

I tried to write a n If statement into the SQL statement, which

accomplishes
the same thing on the Access side, but then when I refresh in Excel, I get

a
message saying "too few parameters".

I need for the empty cells to convert to zero for use in functions that
display averages over time.

What is the best way to deal with this? Write code that replaces the

empty
cells with zeros? If so, where would I put it?

Thanks in advance.

DEI




Reply
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
External Data Warning Message - I have No External Data in wrkbk Cass_makeitfun[_2_] Excel Discussion (Misc queries) 0 May 12th 10 09:02 PM
Getting External Data based on criteria insde of the external data BigMacExcel Excel Discussion (Misc queries) 0 August 31st 09 06:41 PM
Failed to save table attributes of (null) into (null). Luca Brasi Excel Discussion (Misc queries) 2 February 4th 09 04:30 PM
Data Validation for Null Karen Excel Worksheet Functions 2 March 7th 07 06:27 PM
Cells().value is null but I can see data JohnEnnever Excel Programming 1 January 8th 04 02:04 AM


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