Results 1 to 5 of 5

Thread: Dlookup (1997)

  1. #1
    New Lounger
    Join Date
    Jun 2004
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Dlookup (1997)

    I have made a query called QRY_PTCA_HP and in this query there are 2 fields: Total which does a count and HandP where the only 2 list values are yes and no. Therefore when I run the query , the results are a total of 1 for no and 45 for yes. On the report, I am trying to find the number of yes and no responses and I have made the following Dlookup for the source
    =DLookUp("Total","QRY_PTCA_HP","[HandP]=Yes") and when I run the report the yes count turns out to be 1. I know there is probably something wrong with the Dlookup. Thanks for your help.

    Ben

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Dlookup (1997)

    What type of field is HandP? If it is defined as a Yes/No field, the expression you use should be OK. If, however, it is a text field, you must put quotes around the value Yes. Since you cannot just use double quotes within a quoted string, use single quotes (for example, there are other options):

    <code>=DLookUp("Total","QRY_PTCA_HP","[HandP]='Yes'")</code>

  3. #3
    New Lounger
    Join Date
    Jun 2004
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Dlookup (1997)

    It was text and your answer worked. How would you alter the dlookup expression if it was not yes or no but null but I wanted to count the null.

    Thanks,
    Ben

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Dlookup (1997)

    To count null values, you would use

    <code>=DLookUp("Total","QRY_PTCA_HP","[HandP] Is Null")</code>

    (Since Null is not really a value, but rather the lack of a value, you can't use = here, you must use Is in the comparison instead.)

  5. #5
    New Lounger
    Join Date
    Jun 2004
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Dlookup (1997)

    thank you.

Posting Permissions

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