# DLookup in MS Access help

**URL:** https://boards.straightdope.com/t/dlookup-in-ms-access-help/241342
**Category:** Factual Questions
**Created:** [April 22, 2004, 2:45am UTC](https://boards.straightdope.com/t/dlookup-in-ms-access-help/241342 "2004-04-22T02:45:41Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![ice1000](https://avatars.discourse-cdn.com/v4/letter/i/a3d4f5/32.png) [@ice1000](https://boards.straightdope.com/u/ice1000)
#### Post date: [April 22, 2004, 2:45am UTC](https://boards.straightdope.com/t/dlookup-in-ms-access-help/241342/1 "2004-04-22T02:45:41Z")

</div>

I’m trying to use the Dlookup function to return one particular value in an Access report from a table.

I built a simple database to learn the syntax and I can’t get it to work.

There is one table, “Table1” that looks like:  
City,State  
Miami, FL  
Dallas, TX

And now I have Report1 (based on the “Table1” Table). I placed a text box named City that is based on the same named field in Table1. I placed another text box with the Record Source as =DLookUp(“State”,“Table1”,[City]=[Reports]![Report1]![City])  
in the detail field.

According to the Help files, that formula should return the corresponding State from table1 but it doesn’t. It only returns the first State, in my case FL.

I also tried: =DLookUp(“State”,“Table1”,"[City]= " & [Reports]![Report1]![City])  
but that just gives me an #error.

What is wrong with the formula? 😕

BTW, I actually have to use a dlookup to return a value from a table totally unrelated table (unlike my example).

---

<div class="post-metadata">

### Author: ![ice1000](https://avatars.discourse-cdn.com/v4/letter/i/a3d4f5/32.png) [@ice1000](https://boards.straightdope.com/u/ice1000)
#### Post date: [April 22, 2004, 2:57am UTC](https://boards.straightdope.com/t/dlookup-in-ms-access-help/241342/2 "2004-04-22T02:57:37Z")

</div>

ok forget it! I just figured it out.

The entire criteria needs to be text.
