Have you considered adding the [insurance] table to the subreport record source so you can bind the [iname] field to the text box?
Otherwise, you could try (if insrcd is numeric):
=DLookUp("iname","insurance","insrcd = " & [insrcd])
If insrcd is text:
=DLookUp("iname","insurance","insrcd = """ & [insrcd] & """")
Duane Hookom MVP
MS Access
To: MS_Access_Professionals@yahoogroups.com
From: sarahk@schemesoftware.com
Date: Wed, 30 Apr 2014 17:28:52 -0700
Subject: [MS_AccessPros] Dlookup in (sub)Report
I have a subreport that is sorting and totaling by a field called 'insrcd'. This fields description is 'iname' in table 'insurance'. In the 'insrcd' footer on the report, I print the 'insrcd' and the total for this category. This works fine. Now I am trying to add the description of 'insrcd' and I can not get it to work. The best I have gotten is the description of the first entry in the 'insurance' table. I added a Text Box and set the control source to '=DLookUp("iname","insurance","insurance.insrcd = " & '[insrcd]')'. This prints the first entry in the insurance table.
The record source for this report is a query 'pr7demog'. I am not printing anything else on this report, the detail section is empty, because all I am interested in is the totals by insrcd category. What am I doing wrong?.
I am using Access 2003 and Win Vista.
All help is appreciated.
Sarah
Reply via web post | • | Reply to sender | • | Reply to group | • | Start a New Topic | • | Messages in this topic (2) |