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!

how to attach (bound) images to record ? 2

Status
Not open for further replies.

Rosti

Programmer
Mar 5, 2002
46
US
Please help!
I have Access table. It has 3 fields: employee_id (number), image_file_path (text), employee_picture (ole-object).
I would like to dynamicaly bind those images that are specified in the image_file_path field to display corresponding picture object in employee_picture field on the form.I want to use "linked" vs. "embeded" images on the form. And also I do not want to manually enter a file path for every picture, but to use those file addresses that are stored in "image_file_path" field.
Thanks in advance.
rosti
 
OK. If I understand you correctly, you have the exact path to the employee's picture in the field named image_file_path. If that is correct, I am not sure why you have what seems to be the picture itself in the table also.

If you have the path, couldn't you get the picture when the user navigates to the record on the form. Create a field on the form that is unbound and pull the picture into it from wherever the path indicates.

Would that work? It just seems like duplication of data to have both the path to the picture and a copy of the picture itself in your table.

Kathryn


 
Kathryn , thank you for the responce.
The pictures are currently stored as separate .jpg images (let say in the c:\images\ directory). So instead of going and manually insert a picture of employee, I would like to bind it with that file path that is located in the "image_file_paht" field. Here is a sample of data in this field: "c:\images\image1.jpg"
 
I don't know if this code sample will help you rosti, I use a local and mapped network drive for linked pix, with their settings stored in a field ([pixlocation]). These are for products, but could apply for anything. Then in the product form i have a true/false flag ([pix])to check if the product has an image, and an unbound image holder. The image assumes the same name as the product part number, and the code merely looks for an image in the location fields that matches the part number. When it comes to updating images i just look for the corresponding part number file name. Simple, clean, and it works.

If Me![Pix] = False Then
Me!Image33.Picture = ""
End If

If Me![Pix] = True Then
Me!Image33.Picture = Me![PixLocation] & Me![Part No] & ".jpg"
End If
If Me![Pix] = True Then
Me!Image33.Picture = Me![NPixLocation] & Me![Part No] & ".jpg"
End If
==============================

Try this, maybe basing the pix file name on a unique employee number or code?

Cheers, Jon.
 
dm1 is right on except I don't see why you need to have the true/false field. If you set Me!image33.picture = "", then nothing should be displayed in the image control. If you use the code that dm1 wrote with the 'on current' on the form, it should work the way you want it to.

Mike Rohde
rohdem@marshallengines.com
 
Thanks, guys let me try it....
rosti
 
IT WORKS !!!!
Thank you all.
rosti
10/25/2000
 
Glad to hear it works... The reason the false was included was when navigating through records. I found that the image for the previous record would remain unless the pix field was re examined...

Jon
 
I did something like this a while back. To get around having the previous image displayed when their wasn't an image on hand for the next employee, I created a "Picture Not Available".jpg (black JPG with white letters)and just assigned it to all the ugly, I mean non-photo'd employees.

Another point. I see a lot of posts that want to store an image in a table in the database. I guess I understand if it is an image of a "widget" that will always look the same. But, if we are talking about an employee, I would just store the link. People change looks, lose/gain weight, etc. If you save the path and you can just copy the new image into the appropriate location. If you store the image, you have to reload it every time it changes.

Just my two cents...


Terry M. Hoey
th3856@txmail.sbc.com

Ever notice that by the time that you realize that you ran a truncate script on the wrong instance, it is too late to stop it?
 
You are totally correct about storing images in the database. Not only might they change, but they take up a lot of space!!!!

Another possibilty for dealing with the no picture problem is to hide the picture control if the picturepath field is null...

If Not IsNull(Me.PicturePath1) Then
Me.Image1.Visible = True
Me.Image1.PICTURE = Me.PicturePath1
Else
Me.Image1.Visible = False
End If

Mike Rohde
rohdem@marshallengines.com
 
This is an old thread, but I was hoping one of you might be able to help me out...

I had figured out how to change the image On_Current a long time ago, but I have a different problem.

I want to show my form, Continuous, but when I do, all images show up as the first image ( even though I have it changing On_Current to each record's image).

Anyone know how to display a continuous form with each linked image showing for each record's path?

-MoGryph
 
To the best of my knowledge you can't change the image on just one record of the continuous form on-the-fly. Access isn't smart enough or I'm not. You can however have a single instance of the picture is a separate little form the is coordinated so that you see the picture of the person on the Current record.

Joe.
 
I am totally new to access databases, and I only want to know how to place an image into some format so that I may see the image and not just have a hyperlink to the file.

Let's say I have these database fields:
ID Title Year Author Image

I want the ID to be a primary key and not null.
The title and author are text fields.
The year is a number field.
The image field I actually want to store images of the books.

Now I want to be able to search the database and see the information, including the images. This does not have to be for a website, just on the local system.

I am having problems because I created the database, and everything is there except for the image. I created a form and a webpage (I presume with activeX controls), and thery do not show the image. The image is an OLE Object, so I don't understand what to do at this point. I am also not sure whether I should be using a form or a webpage to access the information.
Lastly, I would like to search the content from on e page, not the database itself.

Thanks in advance!

Regards,
Rninja Rninja

smlogo.gif

 
Similar problem with pictures in MsAccess..Will anybody help me for that? I've created a database in which detailed info of patients are held. And a bound ole object for the purpose of image files. It worked though with one image but what I need was to keep multi-images of one patient simultaniously and browse through data navigations.
Is it possible?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top