put picture on a report from path in a table (1 Viewer)

murray83

Games Collector
Local time
Today, 11:34
Joined
Mar 31, 2017
Messages
728
this is all back of the envelope coding

problem i have is i need to genereate a report which has a barcode on but we dont have barcode fonts (dont ask) so have used an online tool to generate them all and then have placed the path of each one in a table

so then when the report is run this is what i logical think and would like to happen

Code:
If Location = T_LocationBarcode!Location
AND IF BarcodePath Is Not Null THEN
img_Check_String_Barcode = BarcodePath
End if

but not sure if i would put this in report load or in the control source for the image

thanks for looking


EDIT

After some more searching on ol google i came across this

Code:
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
    Me![Imageframe].Picture = Me![Imagepath]
End Sub

i have replaced the [Imageframe] with my named picture frame and also changed the Me! after the equal to the name of my table

it dosent brake anything but then again dosent display anything either
 
Last edited:

theDBguy

I’m here to help
Staff member
Local time
Today, 04:34
Joined
Oct 29, 2018
Messages
21,357
Hi,

How about rather than use code, try including the path to the image in the record source of your report and simply bind the image control to this field?

Hope it helps...
 

murray83

Games Collector
Local time
Today, 11:34
Joined
Mar 31, 2017
Messages
728
Hi,

How about rather than use code, try including the path to the image in the record source of your report and simply bind the image control to this field?

Hope it helps...

its an option but i have more than one image so how would i differentiate on what is binded (bound even)
 

murray83

Games Collector
Local time
Today, 11:34
Joined
Mar 31, 2017
Messages
728
for instance have tried this but i just have an empty image

Code:
Private Sub Report_Current()

If Me.txt_MULocation.Value = (DLookup("[Location]", "T_LocationBarcode", "[Location] =" & Forms![F_Main]!txtLocation)) Then
    Me.img_Check_String_Barcode.Picture = T_LocationBarcode!BarcodePath
Else
End If

End Sub
 

theDBguy

I’m here to help
Staff member
Local time
Today, 04:34
Joined
Oct 29, 2018
Messages
21,357
If you add the path to the record source, then each record should display a different path, correct? If so, then when you bind an image control to this field, each record should display a different/matching image. Coding it is not really required anymore, since I believe Access 2010.

Hope it makes sense...
 

theDBguy

I’m here to help
Staff member
Local time
Today, 04:34
Joined
Oct 29, 2018
Messages
21,357
for instance have tried this but i just have an empty image

Code:
Private Sub Report_Current()

If Me.txt_MULocation.Value = (DLookup("[Location]", "T_LocationBarcode", "[Location] =" & Forms![F_Main]!txtLocation)) Then
    Me.img_Check_String_Barcode.Picture = T_LocationBarcode!BarcodePath
Else
End If

End Sub
Hi,

Like I was saying, don’t try to use any code at all. You might find your life simpler if you’re able to achieve the same effect without using code.
 

murray83

Games Collector
Local time
Today, 11:34
Joined
Mar 31, 2017
Messages
728
hold the bloody phone i may have cracked the searching lark

just came across this page https://bytes.com/topic/access/answers/876256-linking-picture-access-report

and this snippet of code

Code:
Private Sub Report_Open(Cancel As Integer)
  Me![imgLogo].Picture = DLookup("[Path]", "tblLogo")
End Sub

and it works, it bloody works

well it displays the first image path so now just got to get to do some checking based on locations and make sure they both match

one happy camper
 

theDBguy

I’m here to help
Staff member
Local time
Today, 04:34
Joined
Oct 29, 2018
Messages
21,357
Hi,

Congratulations. Glad to hear you are making some progress trying to use code. I just feel like you would have been done by now if had stopped trying to use code.

Good luck!
 

Users who are viewing this thread

Top Bottom