+ Reply to Thread
Results 1 to 5 of 5

DLookUp function

  1. #1
    Forum Contributor
    Join Date
    06-20-2013
    Location
    Dallas, Texas
    MS-Off Ver
    Excel 2007
    Posts
    106

    Post DLookUp function

    getPEReason.PNG

    fail_reasons.PNG

    Hi,
    I'm having trouble with the DLookUp function in Access 2010 (it should also work in Access 2007). I'm also having trouble with my Error Handling, when it runs this DLookUp function.

    Please Login or Register  to view this content.
    I have shown a picture of the code in VBA Access and I have shown a picture of the 03_02_Fail_Reasons table.
    Last edited by rmachbitz; 07-02-2013 at 05:09 PM.

  2. #2
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: DLookUp function

    What exactly is the problem?

    Are you getting errors, incorrect results?
    If posting code please use code tags, see here.

  3. #3
    Forum Contributor
    Join Date
    06-20-2013
    Location
    Dallas, Texas
    MS-Off Ver
    Excel 2007
    Posts
    106

    Re: DLookUp function

    (1) In the immediate window when I look at criteria, I get these values.

    ?criteria
    LoadDate = #6/28/2013# and AreaID = 'Eaches' and Reason = 'Underpick'

    (2) When I look at the table, there is no value for that. I think there is an error handling procedure right below that says:
    NoData:
    getPEReason = 0

    (3) But it never gets to that point --> the error handling point.

    (4) What’s your suggestion? Change the Reason to not unknown, because it doesn’t find that value of reason as ‘underpick’

    The question is why is it returning no value. In the error it says "the value is NULL."

  4. #4
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: DLookUp function

    If you remove On Error... do you actually get an error?

  5. #5
    Forum Contributor
    Join Date
    06-20-2013
    Location
    Dallas, Texas
    MS-Off Ver
    Excel 2007
    Posts
    106

    Re: DLookUp function

    Please Login or Register  to view this content.
    This code actually works better than On Error.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1