Results 1 to 6 of 6
  1. #1
    thart21 is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Mar 2010
    Posts
    83

    Nz function and link to Excel

    Hi there, can't seem to find a solution to this seemingly easy problem anywhere. Since Excel does not recognize the Nz function, how would I re-write this in my query grid,



    Fixed: Nz([Fixed Qty],0)+Nz([Schl Del Qty],0)

    I've tried to change it to:
    Sum(Iif(IsNull([Fixed Qty],0))+(Iif(IsNull([Schl Del Qty],0)))))

    Which gives me a "wrong number of arguments" error.

    Am I close?? Thanks for any help,

    Toni

  2. #2
    boblarson is offline --------
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jun 2011
    Posts
    1,272
    If the query is in Access then the NZ function should work. If you are doing the query from MS Query then you would have to do it the second way but you are only supplying a value for the True side - you also need to supply the False side:

    Sum(Iif(IsNull([Fixed Qty],0,[Fixed Qty]))+(Iif(IsNull([Schl Del Qty],0,[Schl Del Qty])))))

  3. #3
    thart21 is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Mar 2010
    Posts
    83
    Hey Bob, thanks for the reply, what happened was, I already have my Access query linked to Excel and it's been working great, when I added the field with the Nz function and went to refresh my link in Excel, I got the Nz undefined function error.
    I just tried your suggestion and got the "wrong # of arguments error" but I understand what you are saying and will play around with it. Thanks so much!

    Toni

  4. #4
    thart21 is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Mar 2010
    Posts
    83
    I give up, I've tried changing location of ")", "0" and other fields, but continue to get the same error, any ideas on what might be missing?

    Thanks!

    Toni

  5. #5
    boblarson is offline --------
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jun 2011
    Posts
    1,272
    Sorry, I didn't look carefully enough at the parens. This should work:

    Sum(IIf(IsNull([Fixed Qty]), 0, [Fixed Qty]) + IIf(IsNull([Schl Del Qty]), 0, [Schl Del Qty]))

  6. #6
    thart21 is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Mar 2010
    Posts
    83
    Thanks Bob, appreciate the help!

Please reply to this thread with any new information or opinions.

Similar Threads

  1. link to excel with chart
    By rickscr in forum Programming
    Replies: 8
    Last Post: 04-25-2011, 06:22 PM
  2. Link Excel to Access problem
    By gg80 in forum Access
    Replies: 1
    Last Post: 02-22-2011, 09:35 AM
  3. link between excel and ms-access
    By Bala Preetha in forum Access
    Replies: 1
    Last Post: 11-28-2010, 08:23 PM
  4. Access link to excel file
    By delkath in forum Access
    Replies: 3
    Last Post: 09-13-2010, 12:28 PM
  5. Link from access forms to Excel file
    By aligahk06 in forum Forms
    Replies: 1
    Last Post: 04-30-2010, 04:24 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums