Hi everyone, I'm having a bit of an issue with DLookup and can't seem to figure out why.
I'm building a database to keep track of sign up info for a annual family camp. Each family has a record which includes who's attending, when they'll be there, etc. In a separate table, I've listed out the costs for each age category the campers fall into (baby, child, adult) with and without an early sign up discount, and each record corresponds to how many days the camper will be onsite. See below:

For each family record, I have the following:
- a field that calculates how long they'll be staying (for ease of entry) based on when they arrive and depart
- a field that returns early or late based on their sign-up date
- and a field that returns their age category based on the entered age
All this is used in a DLookup within a control box on the entry form to list what their cost per camper will be, and that's where I run into an issue.
If I run my calculation with this code:
Code:
=DLookUp("EarlyAdult","Rates","ID = [Camp Attendees]![Time1]")
It correctly returns the cost from my table. However, what I'd like to do is replace the "EarlyAdult" in the code with a reference to a field that has the fieldname I want to look for stored in it.
I've tried this:
Code:
=DLookUp("[Camp Attendees]![RateType1]","Rates","ID = [Camp Attendees]![Time1]")
But Access thinks I'm looking for a field called RateType1, not the data stored in that field, and returns #Error in my control box. How do I get Access to use the data in [RateType1] to look for a field rather than look for [RateType1] itself?