Can Grow, Can Shrink Access Reports for OLE Objects and Attachments Pictures Images

new_guy_tom

Registered User.
Local time
Tomorrow, 04:45
Joined
May 14, 2010
Messages
13
Hi All,

I was hoping that somebody could help me and I apologize if this question has already been asked.

I have a table which I plan to have an OLE Object or Attachment of of a .bmp file in. I want to display the .bmp images in a report which I can do however I want to to either grow or shrink depending on their size. I have Access 2007.

What I am wanting to do is create layout drawings of a product that has modular components that can be configured in any configuration. Each image of a modular part is the same width with a variable height so when they are displayed in a report they create a 2D image of the finished product.

The user would simply choose the part that they want in the drawing (via a yes/no data type) and sort the order by a number.

I have check the properties in the report and I can't seem to be able to find a way to do this like you can with a text box. I was hoping that somebody could point me in the right direction or if anybody would know a VBA code that could accomplish this.

Any help would be appreciated.

Thank you.
 
In the control properties of the image you should find a property called Can Grow/Can Shrink. Set these both to Yes and see if it makes any difference.
 
Hi DCrake,

Thank you for the info.

When you say the control properties for the image are you refering to the the properties that can be changed in the Report design?

If this is not what you are refering to please point me in the right direction.

Regards
 
When you drop the image control into the report that will display the image it will have the porperties mentioned. So yes, set them in design mode.
 
Hi DCrake,

I can't seem to see these controls available for an image control however I can find them for a text box under the Format Tab in the Property Sheet.

Is there any other way that you know of?

Regards
 
I'm not sure that the there are native Can Grow / Can Shrink properties associated with image controls.

Simon
 
I'm not sure that the there are native Can Grow / Can Shrink properties associated with image controls.

Simon

I was searching too and I don't see any for either the image control or the OLE Object Bound Control.
 
Hi Everybody,

Thanks for your replies.

Maybe there is a code i can put in the onformat event. Just got to work out the code, any ideas?

Regards
 
Not sure what you would use. You would need to have some means to identify the actual size of the image. Not sure how you would get that.
 
You should be able to interrogate the image and ascertain its size. I use an ActiveX Image control but I think this works although I couldn't get the file size to work. Forgive me but i can't remember why the size is divided by 15.
Code:
Function SetPicture()
Dim FullPath As String
Dim ImageW As Integer
Dim ImageH As Integer
    With CodeContextObject
        FullPath = GetImageDir & .[Image File]
        ImageW = CInt(.[ImageControl].ImageWidth / 15)
        ImageH = CInt(.[ImageControl].ImageHeight / 15)
        If Dir([FullPath]) = Empty And .[Image] = -1 Then
            .[Image] = 0
        ElseIf Dir([FullPath]) <> Empty Then
            If .[Image] = 0 Then
               .[Image] = -1
            End If
            If .[Image Width] <> ImageW Or .[Image Height] <> ImageH Then
                .[Image Width] = ImageW
                .[Image Height] = ImageH
'                .[Image Size] = .[ImageControl].ImageBytes
            End If
        End If
    End With
End Function

Simon
 
Hi All,

First of all, a big thanks to everybody that has contributed so far. Below is the code that I have found that does most of the job

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

If (Me.length) = "0.0265" Then
Me.Image18.Picture = Me.path
Me.Image18.Visible = True
Me.Image18.Height = "285"
Me.Image18.Width = "2000"

Else

If (Me.length) = "0.1325" Then
Me.Image18.Picture = Me.path
Me.Image18.Visible = True
Me.Image18.Height = "2550"
Me.Image18.Width = "2000"

Else

If (Me.length) = "0.2385" Then
Me.Image18.Picture = Me.path
Me.Image18.Visible = True
Me.Image18.Height = "4500"
Me.Image18.Width = "2000"

Else

Me.Image18.Picture = Me.path
Me.Image18.Visible = True
Me.Image18.Height = "285"
Me.Image18.Width = "2000"

End If
End If
End If

End Sub

This works well however if I have multiple modular components that are the same length the above code will only modify the size of the image control for the first one in the table, the second component that is the same length does not size the image control correctly.

I hope somebody can help me with this.

Regards
 
Attached is the problem I am having. The image control sets the picture size to the largest image as it runs through the records, so if the largest picture comes first it will set the picture size to this size for all following pictures.

Maybe I could sort the records by image size and then sort by code after the pictures have been generated to put them in the right order.

Has anybody got any ideas?

Regards
 
and the attachment
 

Attachments

  • example.jpg
    example.jpg
    23.5 KB · Views: 660

Users who are viewing this thread

Back
Top Bottom