2manyerrors
Programmer
Hi, I'm trying to make this code work on my form but can't seem to get it working. I hope someone can help. Thanks a head of time.
I have a form that links to some picture files and displays the picture in a box. The form works fine except for when the picture is missing or when it is deleted then the picture that was displayed in the prior record is used. I'm trying get the form to display a default image from my c drive such as C:\noimage.jpg if there is no picture or if the picture have been deleted. This way the user will know that the picture does not exist.
Here are my codes for the on current and on load:
--ON CURRENT--
Private Sub Form_Current()
On Error GoTo err_Form_Current
If Not Me!txtPicture = "" Or Not IsNull(Me!txtPicture) Then
Me!Picture.Picture = Me!txtPicture
Else
Me!Picture.Picture = ""
End If
exit_Form_Current:
Exit Sub
err_Form_Current:
MsgBox err.Description
Resume exit_Form_Current
End Sub
---ON OPEN---
Private Sub Form_Open(Cancel As Integer)
On Error GoTo Err_Form_Open
If IsNull(Me!txtPicture) Or Me!txtPicture = "" Then
' do nothing
Else
Me!Picture.Picture = Me!txtPicture
End If
Exit_Form_Open:
Exit Sub
Err_Form_Open:
MsgBox err.Description
Resume Exit_Form_Open
End Sub
I have a form that links to some picture files and displays the picture in a box. The form works fine except for when the picture is missing or when it is deleted then the picture that was displayed in the prior record is used. I'm trying get the form to display a default image from my c drive such as C:\noimage.jpg if there is no picture or if the picture have been deleted. This way the user will know that the picture does not exist.
Here are my codes for the on current and on load:
--ON CURRENT--
Private Sub Form_Current()
On Error GoTo err_Form_Current
If Not Me!txtPicture = "" Or Not IsNull(Me!txtPicture) Then
Me!Picture.Picture = Me!txtPicture
Else
Me!Picture.Picture = ""
End If
exit_Form_Current:
Exit Sub
err_Form_Current:
MsgBox err.Description
Resume exit_Form_Current
End Sub
---ON OPEN---
Private Sub Form_Open(Cancel As Integer)
On Error GoTo Err_Form_Open
If IsNull(Me!txtPicture) Or Me!txtPicture = "" Then
' do nothing
Else
Me!Picture.Picture = Me!txtPicture
End If
Exit_Form_Open:
Exit Sub
Err_Form_Open:
MsgBox err.Description
Resume Exit_Form_Open
End Sub