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

Bound Object Frame - 'Shrinking' on Report

Status
Not open for further replies.

rarebeast

Technical User
Jul 10, 2002
1
GB
Hi,

I have packshot images for some (but not all) products stored in the appropriate table (OLE field) that I want to appear as images immediately above the relevant products in reports. This (obviously) requires that a Bound Object Frame be placed on the report layout.

It seems that there is no way (via the frame properties box at least) to 'shrink' (or indeed 'grow') this frame, meaning that - for those products where no image exists in the table - there remains a big white space on the printed report!

This surely can't be right?! This must be a very common requirement. Perhaps I'm just missing something obvious?

Hope someone can help!

Many thanks.
 
RareBeast,

Here's some sample code that you can adapt to do what I think you're intending:

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)

Dim R As Report: Set R = Me
Const TwipsPerCm = 567

ShowImage = True 'Set this to True to resize and display image

If ShowImage Then
ImageHeight = 3 * TwipsPerCm
SectionHeight = 3.5 * TwipsPerCm
Else
ImageHeight = 1 * TwipsPerCm
SectionHeight = 1.5 * TwipsPerCm
End If

R!OLEBound0.Height = ImageHeight
R!OLEBound0.Visible = ShowImage
R.Section("Detail").Height = SectionHeight

End Sub

Note the following:

(a) The sample code does not include declarations of local variables
(b) The code is associated with the Detail section's format event, so it will be triggered for each record.
(c) Set the ShowImage variable according to your own criteria.
(d) Since there is no CanGrow/CanShrink property associated with the bound object, we need to force the section to grow or shrink by playing with its Height property directly.
(e) Setting the .visible property of the unbound frame also allows the frame border to be easily shown or hidden.

Hope this helps,
Cheers,

Steve Lewy
Solutions Developer
steve@lewycomputing.com.au
 
I have jpg images for some (but not all) products stored in my database that I want to appear as images to the right of the descriptions in the report.

I placed a bound object in the report, but, I haven't figured out how to shrink/grow the frame properties for the records that I don't have an image for.

Does anyone know of a way to do this or set the properties visible/not visible. I don't want this big white space on my report for records without pictures.

My bound object names is [picture1] and the size is 1.5 x 1.5

Also, is there an easier way to insert these pics in the database without having to past each picture?

Thanks.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top