I have a query titled "Query1" that has the following fields: Issue, Engagement and Year. In a separate field in Query1, I want to run a dlookup against a different query titled "Query2," which also contains fields titled Issue, Engagement, year, plus an additional field titled "CaseNo." I want the result of the dlookup to find the CaseNo from Query2 that is in the same row as the Issue, Engagement and Year in Query1. There are no repeats in Query 2. That is, there is no row in query 2 where the same combination of Issue, Engagement and Year are repeated.
Here is the dlookup formula that I created. Note that all of the criteria fields are strings. So I used the string snytax.
For some reason the result I get is the CaseNo in the first Line in Query 2 where the Issue matches. It's as if the Dlookup is searching for the first row where Issue matches and stopping there, instead of then searching for where Engagement and Year also match. Am I going about this the wrong way? Is there another way to acheive the same outcome? I'm open to any suggestion.Code:DLookUp("[CaseNo]","[Query2]","[Issue] = '" & [Issue] & "'" And "[Engagement] = '" & [Engagement] & "'" And "[Year] ='" & [Year] & "'")