Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 31
Default NZ function doesn't work!

I use Excel Macro to run some Access query. NZ function works fine in Access.
But it doesn't work when I was connecting to Access through Excel macro. The
error message says it doesn't recognize the "NZ" function.

Could anybody help me to find a way around?
MY ADO library version is 2.7, I don't know if that is the problem.

Thanks!
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,163
Default NZ function doesn't work!

ADO uses SQL to communicate with your database, so you need to use SQL
syntax. NZ() is an Access expression, not SQL.

The way around this depends on how you needed to use the NZ function, but
lets say you want something like "SELECT MAIL_LIST.NAME, MAIL_LIST.ADDRESS,
NZ(V.ZIP_CODE,"Unknown") FROM MAIL_LIST"; you can achieve the same result
with this SQL query:

SELECT MAIL_LIST.NAME, MAIL_LIST.ADDRESS, MAIL_LIST.ZIP_CODE AS ZIP FROM
MAIL_LIST WHERE MAIL_LIST.ZIP_CODE IS NOT NULL
UNION
(SELECT MAIL_LIST.NAME, MAIL_LIST.ADDRESS, 'Unknown' AS ZIP FROM MAIL_LIST
WHERE MAIL_LIST.ZIP_CODE IS NULL)
--
- K Dales


"salut" wrote:

I use Excel Macro to run some Access query. NZ function works fine in Access.
But it doesn't work when I was connecting to Access through Excel macro. The
error message says it doesn't recognize the "NZ" function.

Could anybody help me to find a way around?
MY ADO library version is 2.7, I don't know if that is the problem.

Thanks!

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 31
Default NZ function doesn't work!

That's for answering my question!

The way I am using NZ is like the following:
Sum(a.[Result]+nz(b.[Result],0)), because table a is bigger than table b.
I am trying to use "IIf(isNull(b.[Result]), 0, b.[Result])" to substitute
the NZ function. Looks like it doesn't gave me any error message. I don't
know if it means it is correct or something else. But it is running very
slow. a query that will gave me result in 5 minutes is running for about 1
hour and it is still running.

Do you have any suggestions on my case? Thanks a lot!

"K Dales" wrote:

ADO uses SQL to communicate with your database, so you need to use SQL
syntax. NZ() is an Access expression, not SQL.

The way around this depends on how you needed to use the NZ function, but
lets say you want something like "SELECT MAIL_LIST.NAME, MAIL_LIST.ADDRESS,
NZ(V.ZIP_CODE,"Unknown") FROM MAIL_LIST"; you can achieve the same result
with this SQL query:

SELECT MAIL_LIST.NAME, MAIL_LIST.ADDRESS, MAIL_LIST.ZIP_CODE AS ZIP FROM
MAIL_LIST WHERE MAIL_LIST.ZIP_CODE IS NOT NULL
UNION
(SELECT MAIL_LIST.NAME, MAIL_LIST.ADDRESS, 'Unknown' AS ZIP FROM MAIL_LIST
WHERE MAIL_LIST.ZIP_CODE IS NULL)
--
- K Dales


"salut" wrote:

I use Excel Macro to run some Access query. NZ function works fine in Access.
But it doesn't work when I was connecting to Access through Excel macro. The
error message says it doesn't recognize the "NZ" function.

Could anybody help me to find a way around?
MY ADO library version is 2.7, I don't know if that is the problem.

Thanks!

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
Why won't this function work? Angelsnecropolis Excel Worksheet Functions 3 March 12th 10 05:00 AM
need a function that will work using multiple work books and sheet capt c Excel Worksheet Functions 1 March 30th 09 10:20 PM
Why does my Function not work? [email protected] Excel Discussion (Misc queries) 2 April 27th 07 10:22 PM
how do i get the mid function to work with a zero garbold Excel Worksheet Functions 7 June 7th 06 10:58 PM
function doesn't work Claude Excel Programming 1 December 11th 03 08:48 PM


All times are GMT +1. The time now is 11:12 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"