Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Dlookup Report using table data not working 1

Status
Not open for further replies.

cimoli

Technical User
Jul 30, 2010
207
0
0
US
I have 2 questions that revolve around a REPORT that uses a couple of Dlookup's from a table.
I would like the report to be a template for 2 businesses. I use a field called BusnID to distinguish the records.

The table plays a minor part. The table is called tblBusn which has just 2 records.
One for each of our 2 businesses. I call them business 1 and 2. A number field.
Here is an example of tblBusn (dummy shorty version) :

BusnID PlacesOffered1 Logo1
1 Aruba, Cuba BitmapImage1
2 Paris, Hawaii BitmapImage2

The report records in tblReservation all have a BusnID attached to each record.
Thereby making the BusnID field available to the report.

Pretend that I asked for data pertaining to BusnID 2.

First. I would like the Dlookup to use the report field and look into the tblBusn and find the words in a field named "PlacesOffered1. I tried the below.

=Space(4) & DLookUp("[PlacesOffered1]","tblBusn","[BusnID] = [tblBusn]![BusnID]")

The report runs and seems okay until one see's that the answers are from the BusnID 1 in tblBusn.
It did not match up the BusnID 2 and get the PlacesOffered1 from the second row in tblBusnID.

I wanted to see the words "Paris, Hawaii" but instead got those other 2 cities. So my Dlookup above is wrong somehow.


Secondly. I have a company logo image the report. But our 2 companies each have a logo.
So if i used records from BusnID 2, I wanted the logo from line 2 in tblBusn.
I have a hunch that this Image Dlookup is much different than the above (wrongly) noted numeric
above. I keep getting the busn 1's image incorrectly. What should be the syntax for this one?

I appreciate your help as usual. I will note again that my purpose is to use the same Template Report in the same database but use the BusnID to decide which field Data to use in the body of the report. This is better than making 2 reports. Someday if we add a 3rd business, I will only need to make a BusnID 3 in tblBusn etc and not have to redo the report ever. The style is always the same. The content can change slightly.

Thanks alot. I can make a mini file if I have too. Would take some time to make it though.
Cimoli


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top