Results 1 to 5 of 5
  1. #1
    5 Star Lounger
    Join Date
    Nov 2001
    Location
    Jerusalem, Israel
    Posts
    708
    Thanks
    0
    Thanked 1 Time in 1 Post

    null dlookup (XP/2K)

    I am sure there is the right way to do this.
    I have the following as the control source for a text box on a report:
    =DLookUp("[txtwherefuneral]","tblwherefuneral","[idwherefuneral]=" & [Reports].[rptklitamet].[idwherefuneral])
    How do I add either an IIF or a NZ function so as not to get a "#Error" when the Dlookup returns NULL
    Thanks

  2. #2
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: null dlookup (XP/2K)

    I'm sorry but I don't understand what you're doing. Why are you trying to reference another value on the report? You should have included your dlookup in the query behind the report or better yet, joined the tblWhereFuneral to the other sources in the query under the report. Then you would not require a dlookup at all.
    Charlotte

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

    Re: null dlookup (XP/2K)

    Zave,

    As Charlotte wrote, you should include tblWhereFuneral in the record source of the report, if possible.

    If that is not feasible, the problem you mention is probably not caused by DLookup returning Null, for in that case the text box should remain empty. It's more likely that the Where condition errors. Can IDWhereFuneral ever be empty? If so, try

    =IIf(IsNull([IDWhereFuneral]), Null, DLookup("txtWhereFuneral", "tblWhereFuneral", "IDWhereFuneral=" & [IDWhereFuneral]))

  4. #4
    5 Star Lounger
    Join Date
    Nov 2001
    Location
    Jerusalem, Israel
    Posts
    708
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: null dlookup (XP/2K)

    thanks for the advice

  5. #5
    5 Star Lounger
    Join Date
    Nov 2001
    Location
    Jerusalem, Israel
    Posts
    708
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: null dlookup (XP/2K)

    IDwherefuneral can be empty. That is the problem

Posting Permissions

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