JPG images for report

Enolage

New member
Local time
Tomorrow, 03:26
Joined
Aug 28, 2010
Messages
3
Hi, I have this great form.. I got it from internet by someone that I forgot the name ( I'm sorry)
This form can load a JPG file
but how can I view that JPG image in the report??

the form code :

Option Compare Database
Option Explicit

Private Sub cmdFindImage_Click()
'Confirms that user wants to replate the existing image
Dim bytConfirm As Byte

If Not Me.NewRecord Then
bytConfirm = MsgBox("Are you sure you want to replace the existing image?", vbQuestion + vbYesNo)
If bytConfirm = vbNo Then
Exit Sub
End If
End If
Me.imgImage.Picture = ""
'Sets the image location textbox to whatever file is salected in the Dialog box.
'(FileToOpen, calls a function that opens a File search Dialog box)
Me.txtImageLocation = FileToOpen

End Sub

Private Sub Form_Current()
Me.imgImage.Picture = ""
End Sub

Private Sub txtImageLocation_Click()
Me.imgImage.Picture = Me.txtImageLocation
End Sub

thanks
NB : Im not a programmer.. so I dont really advance in using code...
 
You don't have to struggle with the Code to insert an image into your Report.
1. Open your Report in Design View.
2. Select Image Tool from the Toolbox.
3. Draw an Image Frame on the Report where you want to insert the image.
4. Select an image from your computer, when the Common Dialog Control opens up, and click open to insert the image in your report.
 
Dear Pillai..

Thanks for your info.. but I need more than insert pic in a report...

I have form to input the JPG file into the table (the form code is written in my 1st thread) now.. I want to make a report according to the table.. and I want in my report, the JPG will show as image (not as path) as I need it to be printed..
would you help me?

Thanks
 
This works on any Form or Report, you must have the Invisible to hide the image on your if no image exists!

Code:
Function GetPicture()
Dim FullPath As String
    With CodeContextObject
        FullPath = GetImageDir & .[Image File]
        If Dir([FullPath]) <> Empty Then
            .[ImageControl].Visible = True
            .[ImageControl].Picture = FullPath
        Else
            .[ImageControl].Visible = False
        End If
    End With
End Function

And this is to handle variable image locations:

Code:
Function GetImageDir() As String
GetImageDir = Forms![Menu]![Image Directory]
End Function

If you do need the latter you will need to replace GetImageDir in the former with the directory path.

The Image file is contained on the form or report because it is variable and looks at each record i.e. dynamic.

Simon
 
And make sure the pics don't have too high a resolution. We've run into the situation where, if the pics are over 640x480 then it will only display a couple of pics before it just shows blanks. Not sure what's up with that but if we use 640x480 pics then all of them will show up (lots of pages of them).
 
Size does matter. Check file sizes as the optimum size is under 100KB. Remember a 1000 x 1000 px image is four times the size of a 500 x 500 px image.

Simon
 
Dear Simon and Bob..

Thanks for Ur att and help.. :)
I just come back from long holiday so I not yet open my project again..
I will try what U guys tell me..;)
Once again.. thanks :cool:
 

Users who are viewing this thread

Back
Top Bottom