Set report header dynamically from lookup table

G

ghadley_00

Hi,

I have a report that gets called via a button using a where clause, so
that the report is tailored for a particular user. I am trying to
display a header on the report that lists the name of the user. The
list of user names are stored in a table that I have linked by ID
number to the main table.

I have tried making the heading generate via Dlookup but have been
unsuccessful.

e.g. =DLookUp("Customer","Customers",[CustID]) & "'s List"

Can anyone recommend a way that I can generate this header dynamically?

I should add that in some cases there are no entries in the database
for a particular user, and so the report will only show the header and
the footer (no entries to be listed).

Thanks,

George
(e-mail address removed)
 
A

Al Camp

George,
If Customers is related to the table you are reporting on, then you
should be able to link that table in the query behind the report... via the
ID field.
Then... include the Customer field in your fields, and set up a text
control on the report with this as the ControlSource...
= [Customer] & "'s List"
will always display the proper text for the Customer for the CustID
associated with what you're reporting on.

By the by... the Dlookup function consists of...
DLookup("[FieldNAme]", "TableName", "Where condition")

[CustID]) & "'s List" is just a concatenation, not a legitimate Where
argument.
While my first solution is the best way to go, you could have done what
you originally tried... with this...
DLookup("[Customer]", "Customers", "[CustID] = " & [CustID])
as long as CustID is on the report.
 
G

ghadley_00

for the my lookup table there are 2 fields - an ID number and the
Customer Name. The table of transactions each have a field that is set
to be a lookup from the lookup table. When I tried using = [Customer] &
"'s List" I actualy the ID listed instead of the customer name (which
is what actually gets shown in the report). Any suggestions on what I'm
doing wrong?

Thanks,

George

(e-mail address removed)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top