Picture on Report - Yet Again?

  • Thread starter jversiz via AccessMonster.com
  • Start date
J

jversiz via AccessMonster.com

Ok,

I know I'm going to get a bunch of links posted in this one regarding see
this post here and see this help section there, but I've looked at them and I
still can't get this to work, so here I am.

First of all I am on Access 2000

I am trying to get a picture to display on a form. The directory for the .
jpg/.bmp is located in "tblISF" in a field called "PhotoFilePath". The name
of my unbound object frame is "ImageFrame".

On the report "rptISF", I would like the picture to display in my group
header, so I have tried placing several different variations of the below
code in the "On Format" and "On Print" events, but I have not had any luck.
I was able to get this to work pretty easily on my form, "frmISF", so I am
not sure why I am having a hard time. Any help is appreciated. Thanks!

Variation 1:
If Not IsNull(Me![PhotoFilePath]) Then
Me![ImageFrame].OLETypeAllowed = 1
Me![ImageFrame].SourceDoc = Me![PhotoFilePath]
Me![ImageFrame].Action = 0
Else
Me![ImageFrame].OLETypeAllowed = 1
Me![ImageFrame].SourceDoc = "C:\NA.bmp"
Me![ImageFrame].Action = 0
End If
Variation 1 Error - Type Mismatch

Variation 2
Me.ImageFrame.Picture = Me.PhotoFilePath
Variation 2 Error - Object doesn't support this property or method

Variation 3
Me.ImageFrame.Picture = Forms!frmISF![PhotoFilePath]
Variation 3 Error - Object doesn't support this property or method

Regards,
James C.
EDI Analyst
 
E

Evi

I'll just go through the steps in case you've missed something out. The code
is much simpler than what you've got (yay!)
First check that PhotoFilePath really contains the path to your photo. You
can copy and paste it from the Address bar in Windows Explorer.
PhotoFilePath should be a string field, not an OLE field, in your table
design.
It needs to contain the whole file path and the whole name of your image
including the File Extension eg MyPic.jpg

To insert your ImageFrame in Acc2000 go to Insert, Picture (not Insert
Object), From File, choose any picture. In the Properties box, on the Format
tab, delete the line next to Picture.
Say Yes to Do you want to remove the picture.
Next to picture, it will now say (None)
Name your frame ImageFrame in Properties
Click on the grey bar above the section that contains your Image Frame
In Properties, click on the Events Tab
Click next to On Format
Above where it says End Sub put
Me.ImageFrame.Picture = Me.PhotoFilePath

Evi
 
E

Evi

Sorry, omitted to say
Click next to On Format
Choose Event Procedure
Click just left of the that line to open a code page.
Evi

Evi said:
I'll just go through the steps in case you've missed something out. The code
is much simpler than what you've got (yay!)
First check that PhotoFilePath really contains the path to your photo. You
can copy and paste it from the Address bar in Windows Explorer.
PhotoFilePath should be a string field, not an OLE field, in your table
design.
It needs to contain the whole file path and the whole name of your image
including the File Extension eg MyPic.jpg

To insert your ImageFrame in Acc2000 go to Insert, Picture (not Insert
Object), From File, choose any picture. In the Properties box, on the Format
tab, delete the line next to Picture.
Say Yes to Do you want to remove the picture.
Next to picture, it will now say (None)
Name your frame ImageFrame in Properties
Click on the grey bar above the section that contains your Image Frame
In Properties, click on the Events Tab
Click next to On Format
Above where it says End Sub put
Me.ImageFrame.Picture = Me.PhotoFilePath

Evi

jversiz via AccessMonster.com said:
Ok,

I know I'm going to get a bunch of links posted in this one regarding see
this post here and see this help section there, but I've looked at them and I
still can't get this to work, so here I am.

First of all I am on Access 2000

I am trying to get a picture to display on a form. The directory for
the
.
jpg/.bmp is located in "tblISF" in a field called "PhotoFilePath". The name
of my unbound object frame is "ImageFrame".

On the report "rptISF", I would like the picture to display in my group
header, so I have tried placing several different variations of the below
code in the "On Format" and "On Print" events, but I have not had any luck.
I was able to get this to work pretty easily on my form, "frmISF", so I am
not sure why I am having a hard time. Any help is appreciated. Thanks!

Variation 1:
If Not IsNull(Me![PhotoFilePath]) Then
Me![ImageFrame].OLETypeAllowed = 1
Me![ImageFrame].SourceDoc = Me![PhotoFilePath]
Me![ImageFrame].Action = 0
Else
Me![ImageFrame].OLETypeAllowed = 1
Me![ImageFrame].SourceDoc = "C:\NA.bmp"
Me![ImageFrame].Action = 0
End If
Variation 1 Error - Type Mismatch

Variation 2
Me.ImageFrame.Picture = Me.PhotoFilePath
Variation 2 Error - Object doesn't support this property or method

Variation 3
Me.ImageFrame.Picture = Forms!frmISF![PhotoFilePath]
Variation 3 Error - Object doesn't support this property or method

Regards,
James C.
EDI Analyst
 
B

Bill

I'm not sure how you got yourself into the struggle
you're describing. If you have an image control
on your form or report, you simply set the picture
property to nothing and set the its propery to
"Linked".

At runtime, OnFormat or OnPrint, in your report
you set the picture to the path of the image you want.

If Len(Dir(MyPicturePath)) > 0 Then
Me.MyImageControl.Picture = MyPicturePath
Me.MyImageControl.Visible = True
Else
Me.MyImageControl.Visible = False
End If

Bill
 

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