Results 1 to 4 of 4

Thread: isnull

  1. #1
    Join Date
    Jul 2006
    Posts
    111

    Unanswered: isnull

    Hi,

    I need help constructing my query. In my select block I want to include a columns of the form:

    Code:
    isnull(Max(Table1.Column1),'01/01/1901') AS MaxOf_Table1Col1
    However I get the following error message:
    Code:
    Wrong number of arguments used with function in query expression isnull...

    I have an older query that uses isnull in the form above with no problems and I don't want to have to use the form:
    Code:
    iif(isnull(Max(Table1.Column1)), '01/01/1901', Max(Table1.Column1)) AS MaxOf_Table1Col1
    just because I know that the first one should work and is neater. TIA

  2. #2
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    ISNULL takes one argument, you are feeding it two

    why don't you like the IIF?
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  3. #3
    Join Date
    Nov 2007
    Location
    Adelaide, South Australia
    Posts
    4,049
    ... I don't want to have to use ...
    I'm sure we all don't WANT to use more complex commands, but it's all too often necessary.

    What does the first of January 1901 have to do with it? Maybe you could get away with just:

    Code:
    =Max(Table1.Column1) AS MaxOf_Table1Col1
    Owner and Manager of
    CypherBYTE, Microsoft Access Development Specialists.
    Microsoft Access MCP.
    And all around nice guy!


    "Heck it's something understood by accountants ... so it can't be 'that' difficult..." -- Healdem
    "...teach a man to code and he'll be frustrated for life! " -- georgev

  4. #4
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    It sounds like you are perhaps confusing the T-SQL ISNULL function with the JET\ VBA\ VB ISNULL function. Look up the two on google to see the difference. If you want to convert a null to a value, use nz().

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •