I have a control on a report that I need to set the properties to get the following data. The report has a textBox control called EMP_ID and I have a table called tblDocsIssued. This table has the fields EMP_ID, docDate and docType. I need to get the comment that has the most recent docDate and docType =4 that matches the [EMP_ID] on the report. I tried the following and I think I am close, but not quite there. Probably a quote missing or in the wrong spot. What would be the proper way to do this?
Code:
=Dlookup("comments", "tblDocsIssued", "EMP_ID = '" & [EMP_ID] & "' AND DMax("docDate","tblDocsIssued","docType=4 And Emp_ID='" & [Emp_ID] & "'")")