I tested it and it seems it unfortunately doesn't work.
I get an error message: Error 2220 The file cannot be opened.
This is the code I used:
Code:
Private Sub Knop7_Click()Foto_DblClick (False)
End Sub
Private Sub Form_Current()
If Not Trim(Me.pad) = "" Then
Me.Foto.Picture = Trim(Me.pad)
Me.Foto.Visible = True
Else
Me.Foto.Visible = False
End If
End Sub
Private Sub Foto_DblClick(Cancel As Integer)
Dim strPad As String 'bevat de naam van de afbeelding
strPad = selectFile()
If Not strPad = "" Then
Me.pad = GetPath() & "\Afbeeldingen\Fotos\" & [strPad]
Me.Foto.Picture = Trim(Me.pad)
Me.Foto.Visible = True
Else
Me.Foto.Visible = False
End If
End Sub
Code:
'--------------------------------------------------
' File Browse Code
'--------------------------------------------------
'NOTE: To use this code, you must reference
'The Microsoft Office 14.0 (or current version)
'Object Library by clicking menu Tools>References
'Check the box for:
'Microsoft Office 14.0 Object Library in Access 2010
'Microsoft Office 15.0 Object Library in Access 2013
'Click OK
'--------------------------------------------------
Function selectFile()
Dim fd As FileDialog
Set fd = Application.FileDialog(msoFileDialogFilePicker)
With fd
.AllowMultiSelect = False
If .Show Then
selectFile = Mid(.SelectedItems(1), InStrRev(.SelectedItems(1), "\") + 1)
Else
End
End If
End With
Set fd = Nothing
End Function
Anything I did wrong? Also it asks for pictures to show in an empty database, how is this possible?