Hi
I'm using this code in the form current event.
it seems to be working ok BUT it took a bit of playing around etc..
Has it been written correctly and most effectively, that is, is it best in form current?
AND
the error handling part?
Thx
Darin
I'm using this code in the form current event.
it seems to be working ok BUT it took a bit of playing around etc..
Has it been written correctly and most effectively, that is, is it best in form current?
AND
the error handling part?
Code:
Private Sub Form_Current()
On Error GoTo Err_DisplayImage
Dim stPathA As String
Dim stPathB As String
stPathA = "\\Lynxserver\lynx\EmpPhotos\" & Me.EmpRegNo & ".jpg"
stPathB = "\\Lynxserver\lynx\EmpPhotos\3b.jpg"
If Dir(stPathB) = "" Then
'Open Image
Me.ImageFrame.Picture = stPathB
Else
'Default Image
Me.ImageFrame.Visible = True
Me.ImageFrame.Picture = stPathA
End If
labelRegistration
'Exit_DisplayImage:
'ImageFrame = strResult
''Exit Function
Err_DisplayImage:
Select Case Err.Number
Case 2220 ' Can't find the picture.
Me.ImageFrame.Visible = False
'ctlImageControl.Visible = False
strResult = "Can't find image in the specified name."
'Resume Exit_DisplayImage:
Case Else ' Some other error.
'MsgBox Err.Number & " " & Err.Description
'strResult = "An error occurred displaying image."
'Resume Exit_DisplayImage:
End Select
End Sub
Thx
Darin