Doing a DLookup in a report

G

Guest

In a form if I wanted to lookup a value of a field which was not tied to the
table on the report I would use a DLookup. Is there an equalivant on a
report?

Also since there are very few events, where would I tie something like this?

Thank you again for all of your help.
 
A

Allen Browne

Use DLookup() in the control source of the text box, e.g.:
=DLookup("Field1", "Table1")

If it really does need code to look up the value and assign it to an unbound
text box, use the Format event of the section that contains the text box.
 
G

Guest

Allen,

I am a wee bit confused. The report does not have any text boxes. I am
just attempting to be able to get a value from another table which is not
part of the select statement for the report (similar to the DLookup in a
form). This is my report

From the sad table:
Cust, Number, Item Number

From the Customer Table
Name

I want the Customer Name which corresponds with the cust from the sad table.
Cust from the sad table is in the header and not repeated. So the report
would look like:

Cust Name
Number Item Number
Number Item Number
etc.

Does this make sense (it is late, so I just want to make sure).

Thanks,
 
A

Allen Browne

Open the report in design view.
Do you see any boxes on the report where the Cust field will display?
These are text boxes.
Right click them, and choose Properies.
On the Data tab is the Control Source.
That's where the expression goes.
 

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

Similar Threads


Top