Need Help Modifying Code to Properly Size Detail Section

V

Vance

Hello. I have a report that displays craft item's description and a
picture, side by side, in the detail section. Some crafts have
pictures, and some do not. Likewise, other items have long
descriptions, and others do not. The image is not stored in the
database, but the image control (ctlImage) uses the picture's path
which is stored in a text field (fldImagePath).

MY PROBLEM... because the size of the craft description (fldCraftDesc)
and its picture varies, I need the detail section to grow and shrink
accordingly. I ran a search on Google Groups and found a previous
message posted by Stephen LEBAN (thanks!) that provided code that
addressed my problem in part. It sets the size of the image control
to that of the record's picture, then sets the detail section's height
to the picture's height (plus a border):

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
' Extra space for border
Dim sngBorder As Single

' 1/8th of an inch
sngBorder = 1440 / 8

' Scalemode = twips
Me.ScaleMode = 1

Me.ctlImage.Picture = Me.fldImagePath

' Set the Image control to height of current Image contents
Me.ctlImage.Height = Me.ctlImage.ImageHeight
Me.ctlImage.Width = Me.ctlImage.ImageWidth
Me.Section(acDetail).Height = Me.ctlImage.Height + sngBorder
End Sub

I may have done something wrong, but there is still extra space
appearing below many (but not all) of the records that have a picture.
If there is NO text in the craft's description field (located
adjacent to the image field), then there is NO space; but the more
text that is entered in the craft description field the larger amount
of blank space that appears between the records... there appears to be
a direct correlation between the two fields, but I can't figure it
out. If, however, the record has a lengthy craft description (but no
picture), then the detail section "grows" correctly to accommodate the
text.

Any suggestions on what I'm doing wrong?

Thanks!
Vance
 

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