Hi
I have this code in the current event of the form..
However, I tried adapting it to a MODULE (Photo) and inside the module,
me. could not be used so i changed it to MyForm..
Below is the code BUT the image is not appearing...
Please can u help!!!
Thx
Darin
I have this code in the current event of the form..
However, I tried adapting it to a MODULE (Photo) and inside the module,
me. could not be used so i changed it to MyForm..
Below is the code BUT the image is not appearing...
Please can u help!!!
Code:
Option Compare Database
Option Explicit
Function PhotoGraph()
On Error GoTo Err_DisplayImage
Dim MyForm As Form, C As Control, xName As String
Dim VarTag As Integer
Set MyForm = Screen.ActiveForm
Dim stPathA As String
Dim strResult As String
strResult = "Can't find image in the specified folder!"
stPathA = "C:\Lynx\EmpPhotos\" & MyForm.EmpRegNo & ".jpg"
'stPathA = "\\Lynxserver\lynx\EmpPhotos\" & MyForm.EmpRegNo & ".jpg"
'NOT NEEDED - stPathB = "\\Lynxserver\lynx\EmpPhotos\3b.jpg"
'PhotoGraph
If Dir(stPathA) <> "" Then
'Open Image
MyForm.ImageFrame.Visible = False
MyForm.lblImageNote.Visible = True
MyForm.lblImageNote.Caption = strResult
Else
MyForm.lblImageNote.Visible = False
MyForm.ImageFrame.Visible = True
MyForm.ImageFrame.Picture = stPathA
'Open Image
'Default Image
End If
Err_DisplayImage:
Select Case Err.Number
Case 2220 ' Can't find the picture.
MyForm.ImageFrame.Visible = False
MyForm.lblImageNote.Visible = True
MyForm.lblImageNote.Caption = strResult
'ctlImageControl.Visible = False
'strResult = "Can't find image in the specified name."
'Resume Exit_DisplayImage:
Case Else ' Some other error.
'myform.ImageFrame.Visible = False
'myform.lblImageNote.Visible = True
'myform.lblImageNote.Caption = strResult
''Resume Exit_DisplayImage:
End Select
End Function
Thx
Darin