M
Martin
I have to say my heart sank when I found Access 2003 couldn't display images
(in my case jpegs) in a form-based OLE field. However, it's been a godsend
because I was getting prepared to load over 500 images by hand into my
database and this forum provided a work around, using an unbound image
control, which meant I could directly access the saved photos. In case
anyone's interested, here's the way I found to do this with the OnCurrent
event of the form (in my case, the photos were already handily named by way
of the table's ID field and were stored in a subfolder to the database's own
folder):
Private Sub Form_Current()
On Error GoTo handler
Dim myPath As String
If IsNull(ID) Then 'to stop error with new record
myPath = ""
Else
myPath = CurrentProject.Path & "\" & "Photos\" & ID & ".jpg"
End If
imgPhoto.Picture = myPath 'imgPhoto is name of image control
Exit Sub
handler:
If Err.Number = 2220 Then 'missing photo for ID
imgPhoto.Picture = ""
Else
Msg Err.Number & " " & Err.Description
End If
End Sub
If you've got missing photos, you can put a label behind the image control
saying something like "Photo Unavailable".
(in my case jpegs) in a form-based OLE field. However, it's been a godsend
because I was getting prepared to load over 500 images by hand into my
database and this forum provided a work around, using an unbound image
control, which meant I could directly access the saved photos. In case
anyone's interested, here's the way I found to do this with the OnCurrent
event of the form (in my case, the photos were already handily named by way
of the table's ID field and were stored in a subfolder to the database's own
folder):
Private Sub Form_Current()
On Error GoTo handler
Dim myPath As String
If IsNull(ID) Then 'to stop error with new record
myPath = ""
Else
myPath = CurrentProject.Path & "\" & "Photos\" & ID & ".jpg"
End If
imgPhoto.Picture = myPath 'imgPhoto is name of image control
Exit Sub
handler:
If Err.Number = 2220 Then 'missing photo for ID
imgPhoto.Picture = ""
Else
Msg Err.Number & " " & Err.Description
End If
End Sub
If you've got missing photos, you can put a label behind the image control
saying something like "Photo Unavailable".