R
Rob Parker
I have a subreport which contains only a detail section (set to Can
Shrink -Yes and Can Grow - Yes). The section contains two textboxes and an
image control. The image control, imgImage, is unbound, and the picture is
set by the following code at runtime:
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
'Last edited: Rob Parker, 16 Feb 2006
On Error GoTo Detail_Format_Error
If Not IsNull(Me.Image) Then
' Me.imgImage.Visible = True
Me.imgImage.Height = 8 * 567 '8cm, in twips
Me.imgImage.Picture = Me.Image
Else
' Me.imgImage.Visible = False
Me.imgImage.Height = 0
Me.imgImage.Picture = ""
End If
On Error GoTo 0
Exit Sub
Detail_Format_Error:
If Err.Number = 2220 Then
Me.imgImage.Picture = ""
Else
MsgBox "Error " & Err.Number & " - " & Err.Description & vbCrLf & _
"in procedure Detail_Format" & vbCrLf & "of VBA Document
Report_sbrptArising_Remarks"
End If
End Sub
My problem is that the image control space is always present. Changing its
height has no effect, nor does changing its visibility (the commented-out
code lines are from trying that approach). The image control itself does
not have Can Shrink/Can Grow properties - hence my attempt to do this via
code. Putting the same code in the Detail_Print event also fails - in
particular, the attempt to change the image control height generates an
error, but the visible approach also fails.
How can I remove the white space when there is no picture to be displayed in
the image control?
TIA,
Rob
Shrink -Yes and Can Grow - Yes). The section contains two textboxes and an
image control. The image control, imgImage, is unbound, and the picture is
set by the following code at runtime:
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
'Last edited: Rob Parker, 16 Feb 2006
On Error GoTo Detail_Format_Error
If Not IsNull(Me.Image) Then
' Me.imgImage.Visible = True
Me.imgImage.Height = 8 * 567 '8cm, in twips
Me.imgImage.Picture = Me.Image
Else
' Me.imgImage.Visible = False
Me.imgImage.Height = 0
Me.imgImage.Picture = ""
End If
On Error GoTo 0
Exit Sub
Detail_Format_Error:
If Err.Number = 2220 Then
Me.imgImage.Picture = ""
Else
MsgBox "Error " & Err.Number & " - " & Err.Description & vbCrLf & _
"in procedure Detail_Format" & vbCrLf & "of VBA Document
Report_sbrptArising_Remarks"
End If
End Sub
My problem is that the image control space is always present. Changing its
height has no effect, nor does changing its visibility (the commented-out
code lines are from trying that approach). The image control itself does
not have Can Shrink/Can Grow properties - hence my attempt to do this via
code. Putting the same code in the Detail_Print event also fails - in
particular, the attempt to change the image control height generates an
error, but the visible approach also fails.
How can I remove the white space when there is no picture to be displayed in
the image control?
TIA,
Rob