Dlookup in one table looking for a value in a second table

gheyman

Well-known Member
Joined
Nov 14, 2005
Messages
2,347
Office Version
  1. 365
Platform
  1. Windows
My first Table has two columns: "PROGRAM NAME" and "PROGRAM ID". The table Name is "PROGRAM_LIST"

On my second table, where I am having difficulty, I have a field built with the Lookup Wizard. It puts the List of Program Names in the field named PROGRAM NAME (Same Name different table). In the Next field I want to do a Dlookup to pull in the "PROGRAM ID".

No matter what I try, I keep getting an error. I am putting the formula in the Expression section.

=Dlookup("Program ID","PROGRAM_LIST","[PROGRAM NAME]="PROGRAM NAME")
 

Excel Facts

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.
A few things:

- Remember what I said yesterday, you do not use square brackets in these "D" functions when referring to the Table name or field you want to return. The only time you would do it is if you were returning the value from a Textbox from a Form in your Criteria.
- Don't do calculated fields in Tables. You cannot actually use the DLOOKUP function in a Table calculated field anyhow. I don't believe Table calculated fields can look outside of the Table they are located in. Do all calculations in Queries.
- Using DLOOKUP, in the Criteria argument (third argument), if the value is Text, you need to use Text Qualifiers (single or double quotes).

Take a look at this link here, especially "Example 2", which shows you two ways to do text criteria (one for hard-coded criteria, and the other for criteria in a textbox on a Form):
Microsoft Access tips: Getting a value from a table: DLookup()
 
Upvote 0

Forum statistics

Threads
1,221,780
Messages
6,161,887
Members
451,730
Latest member
BudgetGirl

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top