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

Print image on a report from query 1

Status
Not open for further replies.

MICKI0220

IS-IT--Management
Jul 20, 2004
337
US
I have a report that has many pages. Each page has a different bitmap image that should print on the page based on the item name. I first tried to embed them, but the database bloated. Now I need to associate it by a file. I have been searching for the appropriate code but I can't find exactly what I need. To be a little more clear, a query gives me all the ordered parts for a particular truck. it could be 8 lines. each page will print all the information of the line number and attach the part description to it. Right now if I use an image control, the page is blank and Package shows up when I assign an object as the data type. Someone please tell me how to code this. I know it is doable.

Thanks in advance
 
You could try place a blank image control on the report and use code in the On Print event of the section to set the Picture property of the control to the full file name.

Duane
Hook'D on Access
MS Access MVP
 
I have no clue what the code would be. Could you give me an example that would be similiar to my situation?
 
I tried this and another set of codes and it does not pull up the corresponding picture that goes with the id.
 
I got it to pull up the corresponding picture with this code.

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
If Not IsNull(Me.ImagePath) Then
Me.ImageFrame.Picture = Me.ImagePath


End If

End Sub


However, if I do not have a picture for an existing Item, it populates the image with the previous item's image. How can I make it display nothing in the imageframe if I don't have an image?
 
Code:
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
  If Not IsNull(Me.ImagePath) Then
    Me.ImageFrame.Picture = Me.ImagePath
    Me.ImageFrame.Visible = True
   Else
    Me.ImageFrame.Visible = False
  End If
End Sub

Duane
Hook'D on Access
MS Access MVP
 
okay, I got this to work the way I explained it but another iron has been thrown in the fire.....We converted pdf's to jpg's to use in this report and make it all work....some of the pdf's were multipage, so it converted them into three jpg's. The first has the appropriate name, the second and third have a -2 and -3 added to the end....How to I make the report show these other two pages and print on 2 more pages, right now my program prints the info on the top, then the image on the bottom of the page. I would like that if it has two more parts to this image group to print one on a second page and the third on a third page....I hope I am making sense

Micki
 
Are there a max of 3 total pages?
I would probably try to create 2 more additional detail sections in the report that would each print on a new page. Use code in the on format event of the first new section like:
Code:
  Dim strImagePath as String
[green]  'add the -2 into the file path[/green]
  strImagePath = Left(Me.ImagePath,Len(Me.ImagePath)-4) & _
    "-2.jpg"
[green]  'see if the file exists[/green]
  If Len(Dir(strImagePath))>0 Then
    Me.ImageFrame.Picture = strImagePath
    Me.ImageFrame.Visible = True
   Else
    [green]'Cancel the formatting if no file[/green]
    Cancel = True
  End If


Duane
Hook'D on Access
MS Access MVP
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top