Originally Posted by
John_G
Hi -
You can't refer to tables in an IIF expression like that - Access has no way of knowing which record you want to look at. For you purposes, you need to use the DLookup function, something like this:
=iif(Dlookup("Sex","Recipients",Condition) = "F"; ", born"; ", born on")
The important part is condition, where you have to supply information to tell the DLookup function which record to look at in the Recipients table, and to do that you need to have a field (control) on your report which identifies a recipient.
Suppose the control on the report is called Person_ID, and the ID field in the Recipients table is called Recipient_ID. The condition would then be: "Recipient_ID = " & me!Person_ID
and the complete iif would then be:
=iif(Dlookup("Sex","Recipients","Recipient_ID = " & me!Person_ID) = "F"; ", born"; ", born on")
John