Expression builder for Dlookup

Cberry

Board Regular
Joined
Jul 14, 2006
Messages
95
I am trying to create a query that will return the life expectancy factor from a table based on the calculated age in the query. The following is what I think is the pertinent information.

I have a query that calculates an age in years [MRD Age2] with the formula :Round(DateDiff("m",[IRA DOB],Now())/12,0)
I have a table [UDT] with three fields: primary key, Age of IRA Owner or Plan Participant, Life Expectancy.

I am trying to use another field in the query to return the factor based off of the MRD age by looking up age in the [UDT] table and returning factor.

I tried: UDT Factor: DLookUp([UDT]![Life Expectancy],[UDT],[UDT]![Age of IRA Owner or Plan Participant]=[MRD Age2]) but it returns an error.

Any help on the correct syntax/expression would be great.

Forgot to add that when I run the query it asks for a parameter for [UDT]![Life Expectancy], [UDT], and [UDT]![Age of IRA Owner or Plan Participant]

Thanks,
 
Last edited:

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes
Thanks for your response Alan. I had a bit of problem with the syntax of the criteria, but it's working now.

UDT Factor: DLookUp("[UDT]![Life Expectancy]","[UDT]","[UDT]![Age of IRA Owner or Plan Participant] = " & [MRD Age2])
 
Upvote 0
Just an FYI for you -

Normally in the field and the criteria you don't need to reference the table/query as you already told it where to look.

So this:
UDT Factor: DLookUp("[UDT]![Life Expectancy]","[UDT]","[UDT]![Age of IRA Owner or Plan Participant] = " & [MRD Age2])

Can be shortened down to:

UDT Factor: DLookUp("[Life Expectancy]","[UDT]","[Age of IRA Owner or Plan Participant] = " & [MRD Age2])
 
Upvote 0

Forum statistics

Threads
1,224,522
Messages
6,179,292
Members
452,902
Latest member
Knuddeluff

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