mtagliaferri
Registered User.
- Local time
- Today, 06:17
- Joined
- Jul 16, 2006
- Messages
- 550
I have a code that uploads a photo to be displayed on a form and all works well to a certain degree, by clicking on the "Add" on click event once the correct file is selected it returns to the form but the photo has not been updated unless I click on any other fields in the form which then the photo is updated, what should I had to the following code to refresh the form so that the photo is updated once is selected.
Thanks
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 Photo\Jpg"
If fDialog.Show = True Then
strPath = Trim(fDialog.SelectedItems(1))
DoCmd.RunSQL "update tblCrewMember set Picture = '" & strPath & "' where IDCrewMember = " & CInt(Me.IDCrewMember.Value)
Else
End If
End With
errHandler:
If (Err.Number = USER_CANC) Then
Resume Next
Else
Exit Sub
End If
End Sub
Thanks