mtagliaferri
Registered User.
- Local time
- Today, 12:01
- Joined
- Jul 16, 2006
- Messages
- 550
I am re-designing a DB with new forms, I have created two initial forms and tested them for a long time as fully functional with a command to add a photo on the form; as I have increased the number of new forms suddenly I have realised that the two initial forms which had the cmd button no longer works.
I have no idea of why this is happening, any ideas?
The code that I used is
I have no idea of why this is happening, any ideas?
The code that I used is
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