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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

grouping products with same image...

Status
Not open for further replies.

NicoleG

Technical User
Mar 1, 2005
3
CA
Hello all.

I am trying to put together a report of all the products
in our db. On each page of the report there should be a
photo of the product and then the details of that product.

Here's my problem. Some products correspond to the same
image (ex. shirt with different sizes). I want all
products that correspond to the same image on one page of
the report. So there will only be on image per page, but
each page may have 3 or 5 (or whatever) products that go
with that image.

Any ideas how to do that?

I have tblImages with ImageID & ImageFile(OLE object). Then I have tblProducts with ProductID, ImageID.

In the report, I have set up an bound object frame along with the other pertinent product info (price, etc).

Nicole
 
Probably you have built a Report with a Detail section containing a field with the image and some other with your products information, and set a Group based on ImageID with PageBreak set to YES.

A way to achieve the hidding of duplicate image:
1) Declare a variable of the same type as the ImageID field in the Declaration section of the module attached to the Report.
>>Dim Prev_ImageID as xxxxx
2) Initialize it to a value unmatchable by an actual ImageID in the OpenReport event procedure:
>>Prev_ImageID=0 ' IF zero is a correct value
3) In the Format event procedure of the Detail section, put the following code:
>>If Image_ID_Field=Prev_ImageID then
>> Image_Field.Visible=False
>>Else
>> Image_Field.Visible=True
>> Prev_ImageID=Image_ID_Field
>>End If
where Image_Field is the name of the OLE object field and Image_ID_Field is the name of the field containing the Image_ID. This last one could be Visible=NO if you don't want to print the image_ID on the Report
 
Well, I tried grouping by ImageID and unless I'm doing something wrong (which is possible), it didn't work.

In the sorting and grouping field, I have sorted by Part Number, then grouped by ImageID. Group heading set to yes, group footer to no, Group On to each value, Group Interval to 1, and Keep Together to Whole Group.

What I am getting is a page with the product info and image, then the next page has the group heading with nothing else. Then the next page has the same image with product info.

I don't even want to touch 'hiding the duplicate image' until I can get it grouped correctly.

Any ideas as to what I'm doing wrong?

Nicole
 
You don't have to create a group header, just sort by Image_ID THEN PartNumber. Do not declare any Group Header/Footer. THe section will disappear for your design.
Normally you should get a continuous report, in the right order.
And, you're right to be cautious, then you can try to make the redundant image disappear.


 
Lozere,

Well, I've tried every combination of possibilities and nothing seems to work.

I group by ImageID, with image in header, with no header and image in detail section. I put sort by part number, I removed the sort.

I can't get it to work! Now all I'm getting is the first page has the image and subsequent pages don't, with each product on a seperate page. What I am looking for is the image on one page, and all of the products that go with that image to appear on the same page.

I can't believe it is this difficult to figure out! I've been working on this for 3 days now!

Any other ideas?

Nicole
 
It is that easy to help without having a look....

When it's acceptable for you, the simplest approach from the original situation, where a detail section includes every data on the product, the ImageID, and the image itself, is:
Add in Grouping/Sorting a Sort by ImageID with a GroupHeader.
In this new section put ImageID and the Image itself and set the ForceNewPage of this section to BeforeSection.
Then if needed add in Grouping/Sorting a sort by ProductsID without any GroupHeader or GroupFooter.
In the Detail section let every data you want on each product.

Don't you get something close you expect?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top