#  Other Applications & Softwares  > Access Tables & Databases >  > [SOLVED] DLookUp function

## rmachbitz

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.

----------


## Norie

What exactly is the problem?

Are you getting errors, incorrect results?

----------


## rmachbitz

(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."

----------


## Norie

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

----------


## rmachbitz

```
Please Login or Register  to view this content.
```


This code actually works better than On Error.

----------

