Ricky11
asked on
Access 97 report, how to insert a image based on a field name...
I have a field called REFRENCE
so in a report I would like to create a frame, but dont know which kind ole object ??? then then in the properties of that frame i would like it to load as follows
="D:\PICTURES\[REFRENCE]PI C.JPG"
so if refrence is baby
then the path to the pic file would be
d:\pictures\babypic.jpg
and the picture should load..
also in a report is it possible to have a page header, detail, and page footer on the right side of a pictrure i.e. the picture is to the left of some text..
tks.
so in a report I would like to create a frame, but dont know which kind ole object ??? then then in the properties of that frame i would like it to load as follows
="D:\PICTURES\[REFRENCE]PI
so if refrence is baby
then the path to the pic file would be
d:\pictures\babypic.jpg
and the picture should load..
also in a report is it possible to have a page header, detail, and page footer on the right side of a pictrure i.e. the picture is to the left of some text..
tks.
Do u want to set the path dynamically or in design?
sorry my mistake, almost there
create a image control on your report - it may ask u to select one. Dont worry, just select one then clear the image in report design - look in property Picture
Now in code, u can do this - where ctrlname is the name of your image control
ctrlname.Properties("Pictu re") = "D:\PICTURES\" & Me.Reference & "PIC.jpg"
Assuming Reference is a field on your report
If not, change Me.Reference to whatever u want it to be
Regards to your 2nd question, yes, u can position your image control and insert your text accordingly, how u see fit
create a image control on your report - it may ask u to select one. Dont worry, just select one then clear the image in report design - look in property Picture
Now in code, u can do this - where ctrlname is the name of your image control
ctrlname.Properties("Pictu
Assuming Reference is a field on your report
If not, change Me.Reference to whatever u want it to be
Regards to your 2nd question, yes, u can position your image control and insert your text accordingly, how u see fit
ASKER
i am using acc 97
i inserted a picture then removed the pic from properties change the name of the picture frame to PICTURE, then in the on open event on the report i put your code
firstly i get ctrlname not defined???
then i changed it to this.
PICTURE = "D:\PICTURES\" & Me.Reference & "PIC.jpg"
then it cannot find me.reference when surely the same reference is used in the report query and is also being displayed elsewhere in the report.
then i did this
instead of pulling the reference from the query inside the report i did :
pic = [Forms]![products2].[Text5 4]
PICTURE = "D:\PICTURES\" & pic & "PIC.jpg"
this works,, but the picture firstly displayed in the center of the report and not even inside the image frame at all.
i tried it again and then it said i am unable to assign a property or image to the picture frame for some reasons..
i inserted a picture then removed the pic from properties change the name of the picture frame to PICTURE, then in the on open event on the report i put your code
firstly i get ctrlname not defined???
then i changed it to this.
PICTURE = "D:\PICTURES\" & Me.Reference & "PIC.jpg"
then it cannot find me.reference when surely the same reference is used in the report query and is also being displayed elsewhere in the report.
then i did this
instead of pulling the reference from the query inside the report i did :
pic = [Forms]![products2].[Text5
PICTURE = "D:\PICTURES\" & pic & "PIC.jpg"
this works,, but the picture firstly displayed in the center of the report and not even inside the image frame at all.
i tried it again and then it said i am unable to assign a property or image to the picture frame for some reasons..
ASKER
wooops..
okay silly me i forgot ctrlname is the name of the frame!! okay it does work now but it still cannot find me.reference...
so i have changed it to & pic & which pulls the data from another open form
okay silly me i forgot ctrlname is the name of the frame!! okay it does work now but it still cannot find me.reference...
so i have changed it to & pic & which pulls the data from another open form
ASKER
re image control i cannot position it so that the page header and detail are on the right side of the image contorl, they always appear underneath it.
tks.
tks.
sorry
me.reference
supposed to refer to your refid field, the one holding the value u want
me.reference
supposed to refer to your refid field, the one holding the value u want
ASKER
wanted to follow up with you... i asked a simialr question you will see.
but i put the code in the on page event in a report. however when i print the report it prints the wrong image on each page for each record..
how do i put it in a on current, their is no on current on the report??? in acc 97
tks
but i put the code in the on page event in a report. however when i print the report it prints the wrong image on each page for each record..
how do i put it in a on current, their is no on current on the report??? in acc 97
tks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
then in code u do ctrlname.Picture = "D:\PICTURES\[REFRENCE]PIC