Adding Photos to employee database (1 Viewer)

sladetroityer

Registered User.
Local time
Today, 10:26
Joined
Oct 26, 2011
Messages
149
How can I add Photos to each employee's profile? Is there like a a feature that allows attachements to records within a table?

Please help:)
 

missinglinq

AWF VIP
Local time
Today, 13:26
Joined
Jun 20, 2003
Messages
6,420
This is one of those questions where the version of Access being used is germane.

Linq ;0)>
 

sladetroityer

Registered User.
Local time
Today, 10:26
Joined
Oct 26, 2011
Messages
149
Thanks,

It's the attachment control........ Just figured it out.

I created an attachment field in the employee table, added the attachement and used attachment control to add the photo to the form.

Work's great
 

missinglinq

AWF VIP
Local time
Today, 13:26
Joined
Jun 20, 2003
Messages
6,420
...It's the attachment control...
That means you're using either 2007 or 2010. That's what I meant about it being version-dependent; this Control was not available prior to 2007.

While you can accomplish your task in this manner, in these versions, the next question to ask would be 'is this the most appropriate method,' which really depends on how many Records you're talking about. Using a non-split db or a split db with an Access Front End/Back End, your file size is limited to 2 Gigabytes, which could be problematical.

Pre-2007 this was worked around by storing the path to the image file, rather than the image file itself, in Access. This method is still employed post-2007 in apps where the size limit is being neared.

Linq ;0)>
 

sladetroityer

Registered User.
Local time
Today, 10:26
Joined
Oct 26, 2011
Messages
149
I am using 2010. So how do I use the path? I could store all the photo's in a secure folder. Can you explain how to use the path as opposed to an attachment? I am NOT using a front end/back end database.
 

sladetroityer

Registered User.
Local time
Today, 10:26
Joined
Oct 26, 2011
Messages
149
OK Missingling,
Now we have an issue with the photos. When using the next button to go to the next record the cutrrent picture stays the same if the next person doesn't have a photo loaded. So one person's picture shows up many times in some instances.
 

missinglinq

AWF VIP
Local time
Today, 13:26
Joined
Jun 20, 2003
Messages
6,420
I've never had to do this sort of thing, but I believe most people dummy up a "No photo Available" image and assign it to those Records where no photo is available.

Linq ;0)>
 

vbaInet

AWF VIP
Local time
Today, 18:26
Joined
Jan 22, 2010
Messages
26,374
OK Missingling,
Now we have an issue with the photos. When using the next button to go to the next record the cutrrent picture stays the same if the next person doesn't have a photo loaded. So one person's picture shows up many times in some instances.
Is it a Continuous form or a Single form?

If it's a Continuous form the Control Source of the image control needs to be bound to the field that holds the path to the image. If you do it in code it will repeat across all records.
 

vbaInet

AWF VIP
Local time
Today, 18:26
Joined
Jan 22, 2010
Messages
26,374
I've never had to do this sort of thing, but I believe most people dummy up a "No photo Available" image and assign it to those Records where no photo is available.

Linq ;0)>
Or what I would do is:

1. Ensure the Allow Zero-Length String property of the field containing the path set to No.
2. Use an alternative path when there's no image, using the Nz() function. E.g.:
Code:
=Nz([ImageFieldContainingPath], [CurrentProject].[Path] & "\" & "[COLOR=Blue]NoImage.bmp[/COLOR]")
 

sladetroityer

Registered User.
Local time
Today, 10:26
Joined
Oct 26, 2011
Messages
149
I found the Allow Zero Length property but was is an NZ function? I'm not sure what to do after I set the Allow Zero Property to NO.

:rolleyes:
 

vbaInet

AWF VIP
Local time
Today, 18:26
Joined
Jan 22, 2010
Messages
26,374
Step 2 explains it. Actually, [ImageFieldContainingPath] should have been [TextFieldContainingPath].

What is the Control Source of the image control at the moment?
 

vbaInet

AWF VIP
Local time
Today, 18:26
Joined
Jan 22, 2010
Messages
26,374
What fields does your Image Path table contain? And which one relates to the table bound to your form?
 

sladetroityer

Registered User.
Local time
Today, 10:26
Joined
Oct 26, 2011
Messages
149
The image path table has the path of the image and the employee's ID number which is linked to the employee table by that employee ID
 

vbaInet

AWF VIP
Local time
Today, 18:26
Joined
Jan 22, 2010
Messages
26,374
So using the code I gave you, it would look like this:
Code:
=Nz([strImagePath], "[COLOR=Red]C:\sladetroityer\NoImage.bmp[/COLOR]")
where the red bit is the path to an alternative image when no image exists.
 

Users who are viewing this thread

Top Bottom