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

Logos on a report

Status
Not open for further replies.

madvalpreston

Technical User
Apr 7, 2011
142
GB
Hi

I have a report with a log brought in as an unlinked object.

However, I want the users to be able to add in another logo if possible without having to go into report desing etc.......

Does anyone know of a way that this can be acheived, for example replace exisitng logo with new logo....

Perhaps through a change form.

I dont really want to store the graphic in the DB.

Any ideas

Thanks
 
Hi Duane

Thanks for the reply. Sorry I am not to up on coding, could you explain step by step for me if possible.

Thanks
 
Hi dhookom

I have done a search on what you suggest and many other searches, I just cannot get a solution. I cant believe it can be this hard... I have a samll example databse and in the field it just says Package, I found something onthe MS site about this but no solution, only that it needs OLE server, then I cannot find a solution.....

Any further advice please ....
 
Hi

I found the solution far to complex for my skills and also it does not allow a simple change of log, from what I understood of it..

Thanks
 
Hi

I have given it anopther shot, I am using 2010.

I am stuck on the point

2. On the View menu, click Code, and then paste or type the following code:

Where does this relate to in 2010, I cant amything with View then code.

Thanks
 
oh another area, when creating the form in 1.

What is this part or how do I add this bit?

Image Control
---------------------------------
Name: ImageFrame
Picture: "C:\Windows\Zapotec.bmp"


Thanks
 
madvalpreston said:
2. On the View menu, click Code, and then paste or type the following code:
I assume this is in report design. Double-click the section header bar to open the properties window. Find the On Print Event and select [Event Procedure]. Click the [...] button to go to the code window.

To add an image control on a form, find the image control in the tool box and add it to your form (or report) like you would a label or text box.

Duane
Hook'D on Access
MS Access MVP
 
Hi

No the first bit is the form as well.....

Havent got to the report bit yet. Any ideas where to put it in the form.

I will add an image control, but dont understand why I am pointing to C:\Windows\Zapotec.bmp" I am not using northwind as in the example but just adapting to muy own simple DB, any ideas what I should point to here

Thanks
 
There are many ways to do this. But you need somewhere to store the path to your logo.

You could make a little table of possible logos.
Code:
ID	logoPath      isSelected
1	C:\B.jpg      No
2	C:\e.jpg      No
3	C:\red.jpg    Yes
4	C:\D.jpg      No

on a continous form you could allow the user to see the possible logos and click on one to select. You will need some code to ensure that only one is selected. Or tell the users only one can be checked
just make the control source of the image control on a continous form "logoPath".

Then on the report

Private Sub Report_Open(Cancel As Integer)
Me.imgControl.Picture = DLookup("logoPath", "tblLogos", "isSelected = true")
End Sub

The first one selected will be shown if more than one selected.
 
Hi Majp

This looks interesting. I ahve created a table called images with 3 fields like you suggest

id Autonumber
logopath text
isselected text

I have 2 records

ID logopath isselected
1 c:\pictures\dbimg2397.jpeg yes
2 c:\pictures\dbimg2397.jpeg no

I created a form looking at the images table and added the fields in and I also added in the object box using bound object frame and the souce is logopath.

However when I go into the form it does not show the images. Sorry I am not sure what you mean by some code (sorry not up on VB).

Have I done it correct so far and could you advise further.

Thanks
 
Hi Majp

I have also noted if I click on the balnk space where the picture should be I get this message

"A Problem Occured while Microsoft Access communicating with the OLE server or Active X control"

I ahve searched hard on the web but cannot find an answer, I dont have Norton, I ahve repaired MSOffice but no luck, any ideas on this as well. I am using 2010.

Many thanks
 
In 2007 they added a bound image control which is not the same as a bound ole frame. With a bound image control you can set the control source equal to a field containing a path and voila the image renders.
The bound ole frame must take an OLE field as the control source. The ole object is embedded or linked in the field. They are very different.
 
Hi All

I am a little confused.

1. Firstly I think you are saying I have 2010 and therefore have image control, and therefore should have the control source =Patch.
2. How would this work witht he example table etc.... you gave above Majp, because I liked the idea of the user clicking a YES/NO field and then adapting the report to use the picture selected.

3. COuld you give me an idea of the code I would ahve to put in the form (OnCurrent Event)

Apologies but I am very new to graphics and using them in forms and reports.

Thanks
 
You need some interface to show the possible images and allow the user to select the current image. So I was suggesting a small form bound to the table of images. If this form was continous you could simply make it look like this

image control checkbox
image control checkbox
image control checkbox


where the image control has a control source of logopath and the checkbox has a control source to isSelected. You would see a thumbnail of each image (make the image control small) based on the path. And a checkbox to select the current control. With a little code you could ensure that all the others or unchecked except the most recently selected or do it manually.

Now from the form you could click a button to open the report. In the report you would have an image control for the logo and the code.

Then on the report
Code:
Private Sub Report_Open(Cancel As Integer)
  Me.imgControl.Picture = DLookup("logoPath", "tblLogos", "isSelected = true")
End Sub

This will display whichever logo you selected in the form.

These are both imagecontrols not bound or unbound ole frames.
 
Hi Majp

I have done this as far as the form, but on the form the images do not show (I assume they should),

the form is base on the table and in the image control I have set the control source to the paths of the table and also tried to set it to the path of the file, but I still see no image. I am also using check boxes.

I have not tired the report side yet because so far I cannot see the images in the form even.....

Is there a way I can attach my DB for you to look at it, I have probably not understood completley

Thanks

 
Sorry, my fault. Access handles the following extensions for graphics
"JPG", "GIF", "BMP", "ICO", "PNG", "WMF", "EMF", "DIB", "CGM", "EPS", "PCT", "WPG"

It does not handle JPEG only jpg covert to one of the supported types.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top