mtagliaferri
Registered User.
- Local time
- Today, 06:15
- Joined
- Jul 16, 2006
- Messages
- 550
I currently have a form for all staff which has a an option to add a photo with the following:
It works perfectly but the users have provided feedback that we don't currently have a photo off all staff and is rather time consuming to check if there is a photo available in the folder.
all the photos are named in the folder as "FirstName Surname StaffNumber"
Is there a way when the form is loaded up to automatically display the picture if available in the folder or leave it blank by looking at FirstName&Surname&StaffNumber?
Hope this makes sense....
Code:
Private Sub CmdAddPhoto_Click()
On Error GoTo errHandler
Set fDialog = Application.FileDialog(msoFileDialogFilePicker)
With fDialog
fDialog.AllowMultiSelect = False
fDialog.Title = "Select photo"
fDialog.Filters.Clear
fDialog.Filters.Add "JPEG Pictures", "*.jpg"
fDialog.Filters.Add "BMP Pictures", "*.bmp"
fDialog.Filters.Add "PNG Pictures", "*.png"
fDialog.Filters.Add "All files", "*.*"
fDialog.ButtonName = "Select"
fDialog.InitialView = msoFileDialogViewLargeIcons
fDialog.InitialFileName = CurrentProject.Path & "\Documentation\Crew ID Photos\Jpg"
If fDialog.Show = True Then
strPath = Trim(fDialog.SelectedItems(1))
Dim lngID As Long
lngID = CLng(Me.IDCrewMember.Value)
DoCmd.RunSQL "update tblCrewMember set Picture = '" & strPath & "' where IDCrewMember = " & lngID
Me.Requery
Me.Recordset.FindFirst "[IDCrewMember] = " & lngID
Else
End If
End With
errHandler:
If (Err.Number = USER_CANC) Then
Resume Next
Else
Exit Sub
End If
End Sub
It works perfectly but the users have provided feedback that we don't currently have a photo off all staff and is rather time consuming to check if there is a photo available in the folder.
all the photos are named in the folder as "FirstName Surname StaffNumber"
Is there a way when the form is loaded up to automatically display the picture if available in the folder or leave it blank by looking at FirstName&Surname&StaffNumber?
Hope this makes sense....
