General discussion

Locked

Attach employee photo to database

By dliby ·
I want to link an employees photo to their record in MSAccess 2000. How can I do this?

This conversation is currently closed to new comments.

4 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Comments

Collapse -

by maxwell edison In reply to Attach employee photo to ...

How to Link a Picture to an Access Form:

Use an unbound image frame named: ImageFrame
and add a field to your table called ImagePath.

To add the picture to a report just use code like this in the On Format event of the Detail Section.

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
Me![ImageFrame].Picture = Me![ImagePath]
End Sub

In the OnCurrent event of the form use this code:

Private Sub Form_Current()
On Error GoTo Err_Form_Current

If IsNull(Me![ImagePath]) Then
Me![ImageFrame].Picture = "c:\msaccess.jpg"
Else
Me![ImageFrame].Picture = Me![ImagePath]
End If

Exit_Form_Current:
Exit Sub

Err_Form_Current:
Select Case Err.Number
Case 2220
'ignore the Can't Load Image error
Case Else
MsgBox ("Error # " & Str(Err.Number) & " was generated by " &
Err.Source & Chr(13) & Err.Description)
Resume Exit_Form_Current
End Select

End Sub

The image takes a second or two to load. A dialog is put on screen too.

This process can get very annoying after a while because it happens every time the user navigates to another record.

From Tony Toews' web site:

http://www.granite.ab.ca/access/imagehandling.htm

Examples for download:

http://members.tripod.com/accdevel/imaging.htm

Collapse -

by maxwell edison In reply to

Another possible option.

The AppendChunk Method:

This example uses the AppendChunk and GetChunk methods to fill an image field with data from another record.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/ado270/htm/mdmthappendchunkx.asp

Collapse -

by dliby In reply to

This worked

Collapse -

by dliby In reply to Attach employee photo to ...

This question was closed by the author

Back to Software Forum
4 total posts (Page 1 of 1)  

Related Discussions

Related Forums