Employee Photos

C

Cindy

I have the table with all the employee data, including one text type, called
"photo". In that cell I have the path to the photo I wish to display. I
also have an employee form. I am wanting to display a different photo with
each record. Right now when open my form in normal view, the photo box is
displaying the text with the path to the photo, not the actual photo. How
can I fix this?
 
B

boblarson

In the ON CURRENT event of the form use:

Me.YourPictureControl.Picture = Me!YourPicturePathFieldNameHere
--
Bob Larson
Access World Forums Super Moderator
Utter Access VIP
____________________________________
Access 2000, 2003, 2007, SQL Server 2000, Crystal Reports 10/XI, VB6
WinXP, Vista
 
A

Arvin Meyer [MVP]

In the current event of the form, use a line of code like:

Sub Form_Current()
Me.ImageControlName.Picture = Me.PathControlName
End Sub
 
C

Cindy

Not familar with code, so at a loss, but I put in
Me![ImageFrame].Picture = Me![Photo]
Now when I open the form I have a picture, but it does not change and I am
getting a runtime error 2220, that states, "Microsoft Access is unable to
open the path, h:\gmaa\photo...and it proceeds to give the correct path that
I need for that photo. You can hit "end" and go to the next file and the
path does match the photo that I need to display. If you hit "debug" you get
Me![ImageFrame].Picture = Me![Photo] highlighted in yellow.
 
B

boblarson

Did you actually type it in to the code window - VBA IDE (Integrated
Development Environment)? Or, did you just type it in the properties dialog
that comes up with the form in Design View?

If you did the former, it's in the wrong place.
--
Bob Larson
Access World Forums Super Moderator
Utter Access VIP
____________________________________
Access 2000, 2003, 2007, SQL Server 2000, Crystal Reports 10/XI, VB6
WinXP, Vista


Cindy said:
Not familar with code, so at a loss, but I put in
Me![ImageFrame].Picture = Me![Photo]
Now when I open the form I have a picture, but it does not change and I am
getting a runtime error 2220, that states, "Microsoft Access is unable to
open the path, h:\gmaa\photo...and it proceeds to give the correct path that
I need for that photo. You can hit "end" and go to the next file and the
path does match the photo that I need to display. If you hit "debug" you get
Me![ImageFrame].Picture = Me![Photo] highlighted in yellow.

Arvin Meyer said:
In the current event of the form, use a line of code like:

Sub Form_Current()
Me.ImageControlName.Picture = Me.PathControlName
End Sub
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com
 
C

Cindy

I double click on the form in the upper most left corner square and it opens
the form box, I scrolled down to "on current" then hit the box with the ...
and entered the text into the "Private Sub Form_Current()" area.
If that is wrong, how do I get to the right place?
boblarson said:
Did you actually type it in to the code window - VBA IDE (Integrated
Development Environment)? Or, did you just type it in the properties dialog
that comes up with the form in Design View?

If you did the former, it's in the wrong place.
--
Bob Larson
Access World Forums Super Moderator
Utter Access VIP
____________________________________
Access 2000, 2003, 2007, SQL Server 2000, Crystal Reports 10/XI, VB6
WinXP, Vista


Cindy said:
Not familar with code, so at a loss, but I put in
Me![ImageFrame].Picture = Me![Photo]
Now when I open the form I have a picture, but it does not change and I am
getting a runtime error 2220, that states, "Microsoft Access is unable to
open the path, h:\gmaa\photo...and it proceeds to give the correct path that
I need for that photo. You can hit "end" and go to the next file and the
path does match the photo that I need to display. If you hit "debug" you get
Me![ImageFrame].Picture = Me![Photo] highlighted in yellow.

Arvin Meyer said:
In the current event of the form, use a line of code like:

Sub Form_Current()
Me.ImageControlName.Picture = Me.PathControlName
End Sub
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com

I have the table with all the employee data, including one text type,
called
"photo". In that cell I have the path to the photo I wish to display. I
also have an employee form. I am wanting to display a different photo
with
each record. Right now when open my form in normal view, the photo box is
displaying the text with the path to the photo, not the actual photo. How
can I fix this?
 
B

boblarson

Check out my post here (with screenshots) that show you how to do this.

http://www.access-programmers.co.uk/forums/showpost.php?p=632819&postcount=8

--
Bob Larson
Access World Forums Super Moderator
Utter Access VIP
____________________________________
Access 2000, 2003, 2007, SQL Server 2000, Crystal Reports 10/XI, VB6
WinXP, Vista


Cindy said:
I double click on the form in the upper most left corner square and it opens
the form box, I scrolled down to "on current" then hit the box with the ...
and entered the text into the "Private Sub Form_Current()" area.
If that is wrong, how do I get to the right place?
boblarson said:
Did you actually type it in to the code window - VBA IDE (Integrated
Development Environment)? Or, did you just type it in the properties dialog
that comes up with the form in Design View?

If you did the former, it's in the wrong place.
--
Bob Larson
Access World Forums Super Moderator
Utter Access VIP
____________________________________
Access 2000, 2003, 2007, SQL Server 2000, Crystal Reports 10/XI, VB6
WinXP, Vista


Cindy said:
Not familar with code, so at a loss, but I put in
Me![ImageFrame].Picture = Me![Photo]
Now when I open the form I have a picture, but it does not change and I am
getting a runtime error 2220, that states, "Microsoft Access is unable to
open the path, h:\gmaa\photo...and it proceeds to give the correct path that
I need for that photo. You can hit "end" and go to the next file and the
path does match the photo that I need to display. If you hit "debug" you get
Me![ImageFrame].Picture = Me![Photo] highlighted in yellow.

:

In the current event of the form, use a line of code like:

Sub Form_Current()
Me.ImageControlName.Picture = Me.PathControlName
End Sub
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com

I have the table with all the employee data, including one text type,
called
"photo". In that cell I have the path to the photo I wish to display. I
also have an employee form. I am wanting to display a different photo
with
each record. Right now when open my form in normal view, the photo box is
displaying the text with the path to the photo, not the actual photo. How
can I fix this?
 
A

Arvin Meyer [MVP]

A full demo of how to do this is at my website:

http://www.datastrat.com/Download/Picture2K.zip
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com

Cindy said:
Not familar with code, so at a loss, but I put in
Me![ImageFrame].Picture = Me![Photo]
Now when I open the form I have a picture, but it does not change and I am
getting a runtime error 2220, that states, "Microsoft Access is unable to
open the path, h:\gmaa\photo...and it proceeds to give the correct path
that
I need for that photo. You can hit "end" and go to the next file and the
path does match the photo that I need to display. If you hit "debug" you
get
Me![ImageFrame].Picture = Me![Photo] highlighted in yellow.

Arvin Meyer said:
In the current event of the form, use a line of code like:

Sub Form_Current()
Me.ImageControlName.Picture = Me.PathControlName
End Sub
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com
 
C

Cindy

Here is what is in my code area:
Private Sub Form_Current()
' Display the picture for the current employee record if the image
' exists. If the file name no longer exists or the file name was blank
' for the current employee, set the errormsg label caption to the
' appropriate message.
Dim res As Boolean
Dim fName As String

path = CurrentProject.path
On Error Resume Next
errormsg.Visible = False
If Not IsNull(Me!Photo) Then
res = IsRelative(Me!Photo)
fName = Me![ImagePath]
If (res = True) Then
fName = path & "\" & fName
End If

Me![ImageFrame].Picture = fName
showImageFrame
Me.PaintPalette = Me![ImageFrame].ObjectPalette
If (Me![ImageFrame].Picture <> fName) Then
hideImageFrame
errormsg.Caption = "Picture not found"
errormsg.Visible = True
End If
Else
hideImageFrame
errormsg.Caption = "Click Add/Change to add picture"
errormsg.Visible = True
End If

Something in the code is not working just right or the form is not set up
correct. If I could show you a screen shot, each form shows the correct path
to the correct picture, the picture is just not displaying.

boblarson said:
Check out my post here (with screenshots) that show you how to do this.

http://www.access-programmers.co.uk/forums/showpost.php?p=632819&postcount=8

--
Bob Larson
Access World Forums Super Moderator
Utter Access VIP
____________________________________
Access 2000, 2003, 2007, SQL Server 2000, Crystal Reports 10/XI, VB6
WinXP, Vista


Cindy said:
I double click on the form in the upper most left corner square and it opens
the form box, I scrolled down to "on current" then hit the box with the ...
and entered the text into the "Private Sub Form_Current()" area.
If that is wrong, how do I get to the right place?
boblarson said:
Did you actually type it in to the code window - VBA IDE (Integrated
Development Environment)? Or, did you just type it in the properties dialog
that comes up with the form in Design View?

If you did the former, it's in the wrong place.
--
Bob Larson
Access World Forums Super Moderator
Utter Access VIP
____________________________________
Access 2000, 2003, 2007, SQL Server 2000, Crystal Reports 10/XI, VB6
WinXP, Vista


:

Not familar with code, so at a loss, but I put in
Me![ImageFrame].Picture = Me![Photo]
Now when I open the form I have a picture, but it does not change and I am
getting a runtime error 2220, that states, "Microsoft Access is unable to
open the path, h:\gmaa\photo...and it proceeds to give the correct path that
I need for that photo. You can hit "end" and go to the next file and the
path does match the photo that I need to display. If you hit "debug" you get
Me![ImageFrame].Picture = Me![Photo] highlighted in yellow.

:

In the current event of the form, use a line of code like:

Sub Form_Current()
Me.ImageControlName.Picture = Me.PathControlName
End Sub
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com

I have the table with all the employee data, including one text type,
called
"photo". In that cell I have the path to the photo I wish to display. I
also have an employee form. I am wanting to display a different photo
with
each record. Right now when open my form in normal view, the photo box is
displaying the text with the path to the photo, not the actual photo. How
can I fix this?
 
C

Cindy

I couldn't get your link to show any photos. The form comes up but there was
not a photo.
Here is what is in my form "on-current"
Private Sub Form_Current()
' Display the picture for the current employee record if the image
' exists. If the file name no longer exists or the file name was blank
' for the current employee, set the errormsg label caption to the
' appropriate message.
Dim res As Boolean
Dim fName As String

path = CurrentProject.path
On Error Resume Next
errormsg.Visible = False
If Not IsNull(Me!Photo) Then
res = IsRelative(Me!Photo)
fName = Me![ImagePath]
If (res = True) Then
fName = path & "\" & fName
End If

Me![ImageFrame].Picture = fName
showImageFrame
Me.PaintPalette = Me![ImageFrame].ObjectPalette
If (Me![ImageFrame].Picture <> fName) Then
hideImageFrame
errormsg.Caption = "Picture not found"
errormsg.Visible = True
End If
Else
hideImageFrame
errormsg.Caption = "Click Add/Change to add picture"
errormsg.Visible = True
End If
Each form shows the correct path for the picture I need to show, but there
is no actual photo.

Arvin Meyer said:
A full demo of how to do this is at my website:

http://www.datastrat.com/Download/Picture2K.zip
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com

Cindy said:
Not familar with code, so at a loss, but I put in
Me![ImageFrame].Picture = Me![Photo]
Now when I open the form I have a picture, but it does not change and I am
getting a runtime error 2220, that states, "Microsoft Access is unable to
open the path, h:\gmaa\photo...and it proceeds to give the correct path
that
I need for that photo. You can hit "end" and go to the next file and the
path does match the photo that I need to display. If you hit "debug" you
get
Me![ImageFrame].Picture = Me![Photo] highlighted in yellow.

Arvin Meyer said:
In the current event of the form, use a line of code like:

Sub Form_Current()
Me.ImageControlName.Picture = Me.PathControlName
End Sub
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com

I have the table with all the employee data, including one text type,
called
"photo". In that cell I have the path to the photo I wish to display.
I
also have an employee form. I am wanting to display a different photo
with
each record. Right now when open my form in normal view, the photo box
is
displaying the text with the path to the photo, not the actual photo.
How
can I fix this?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top