×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

how I display a picture on a report

how I display a picture on a report

how I display a picture on a report

(OP)
I have a report where I want to display the company logo.  I am using access 97 and in the database I am storing the name of the company logo but how do I display it.  I tried using an object frame and an image control and I tried setting the control source to c:\pics\[flgLogoName] but this will not work I get a syntax error.  Does anyone know how I can set this up to display the picture?

Any help would be greatly appreciated

Bryant

RE: how I display a picture on a report

I'm not sure which version of Access you're using, but in Access 2000 the best control to use is an image control. When you draw the control onto your report it prompts you for the name of the picture file you want displayed. An open file box is presented for you to tell the control where to find the file.

It is also possible to use an unbound object frame and a select a file to input into the frame. I've been using Access 200 for about a year and don't recall the processes for '97, but I'm sure they are not that different.


Bryan Meek
bmeek@pacbell.net
http://www.handtech.com/meekent
A "Solution Provider" in your corner gives you the personal attention you need to find the right technology solutions for your business.

RE: how I display a picture on a report

(OP)
Ya you can do the same for access.  But I wrote a query that runs based on a firmID because I need to generate the same report for a bunch of different firms stored in my database.  So when I open the report I have to enter the firm ID.  The report will then open and display all of the information I have in the database for that form.  Now one of the field is called flgLogoName.  This field stores the name of the logo for that firm.  

Ex. FirmID=1
The flgLogoName field will have the value of firm1.gif

Firm=2
The flgLogoName field will have the value of firm2.gif

And so on...

So I need to set the path of the picture in the image control to something like this:

c:\pics\[flgLogoName]<\b> but this will not work for the image control unless my syntax is not properly set.

Since I have all of the firms logos stored in c:\pics based on the firm ID the logo should come up in the report


Thanks for your patience

Bryant Moore

RE: how I display a picture on a report

(OP)
I accidently hit the submit post before preview... I have many mistakes in the previous post so I will post it again.

Ya you can do the same for access 97. This is the scoop:
1. I store many different firms in my database

2. I need to generate the same report for each firm.  

3  I designed a query to retrieve only the information in the db for each firm based on the firmid.

4. So when I open the report I have to enter the firm ID.  The query will return all information pertaining to that firm.

5. Now one of the fields returned is called flgLogoName.  This field stores the name of the logo for that firm.  

Ex. FirmID=1
The flgLogoName field will have the value of firm1.gif

Firm=2
The flgLogoName field will have the value of firm2.gif

And so on...

6. So I need to set the path of the picture in the image control to something like this:

c:\pics\[flgLogoName] but this will not work for the image control (I get a syntax error).

Since I have all of the firms logos stored in c:\pics based on the firm ID the logo should come up in the report


Sorry about the bad post

Bryant Moore

RE: how I display a picture on a report

OK, now I understand your situation much better. It sounds like it should be working, what is the exact syntax error message? Does it give any clue to the problem?

When you say you enter the firmID when you open the report, do you have it set as a pop-up window from the query? Sometimes Access runs the query a second time during formatting of a chart, report, or form based on a query. If that happens, the value that was used initially may not be there when it runs a second time. I have worked around that by using a combobox on my form. I let the user choose firmID from a list inside the combobox. This way the value is held no matter how many times Access needs to run the query and the user does not get prompted more than once for the same information.

I like the idea for your report with logos, let me know how this gets resolved.


Bryan Meek
bmeek@pacbell.net
http://www.handtech.com/meekent
A "Solution Provider" in your corner gives you the personal attention you need to find the right technology solutions for your business.

RE: how I display a picture on a report

(OP)
I set the picture path to this:
C:\uvi\NetworkForms\NetworkForms_Local\MemberImages\Logos\[flgLogoName]

In order for it to look for the logo in the Logos folder and the name is store in the field flgLogoName.  But then all it does is look for a pic with the name [flgLogoName]
and of course it cannot find it. Cause there is no pic with that name in that folder.  But the value stored in [flgLogoName] has the name of the pic firm1.gif so I tried putting quotes around the field name to see if it would accept it but it still wont work.
like this:
C:\uvi\NetworkForms\NetworkForms_Local\MemberImages\Logos\"[flgLogoName]"

It is still looking for a picture with the name
"[flgLogoName]"

The same goes for single quotes
'[flgLogoName]'

I have tried other ways like just putting the name flgLogoName and stuff but still it just looks for the name and will not accept it as a variable.  You know what I mean

If I set a control text box with the value of flgLogoName it displays the right logo name.  But I still dont know how I am gonna set an image object to accept that variable's value.

I hope this makes sense also

RE: how I display a picture on a report

Just so you know what I did with the combobox, this is the way I set up my variable to hold the text value of the combobox:

Private Sub CmdTop10AgtsLSUnits_PropCity_Click()
On Error GoTo Err_CmdTop10AgtsLSUnits_PropCity_Click

    Dim stDocName As String
    Dim stLinkCriteria As String

    stDocName = "Top10AgtsLSUnits-PropCity"
    stLinkCriteria = "ListPropCity='" & CmboAgtLSUnits_PropCity & "'"
    DoCmd.OpenForm stDocName, , , stLinkCriteria, acFormReadOnly, acDialog

Exit_CmdTop10AgtsLSUnits_PropCity_Click:
    Exit Sub

Err_CmdTop10AgtsLSUnits_PropCity_Click:
    MsgBox Err.Description
    Resume Exit_CmdTop10AgtsLSUnits_PropCity_Click
    
End Sub

stLinkCriteria is the variable that holds the field name and the value of the combobox.

ListPropCity is the field name.

CmboAgtLSUnits_PropCity is the combobox control on the form.

I don't know if you used the DoCmd.OpenReport method, but wooks very similarly to the OpenForm method and allows criteria and formatting during the open command.

I think you might try setting the entire path and file name into string variables like:
imgPath ="C:\uvi\NetworkForms\NetworkForms_Local\MemberImages\Logos\" & flgLogoName & "'"

We need to get the entire path and file name inside the string value so the syntax is met. It might be a variation of this example.




Bryan Meek
bmeek@pacbell.net
http://www.handtech.com/meekent
A "Solution Provider" in your corner gives you the personal attention you need to find the right technology solutions for your business.

RE: how I display a picture on a report

(OP)
Cool Thanks Bryan

I will check that out and let you know how it goes.

I have started working on other things for now but as soon as I finish up I will be going back.  So I will keep you posted.

Bryant Moore

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close