Novice Access programmer here.
I would like to display an image using the Toolbox Image object by
calling the images file name using:
=fPictureFiles([Forms]![frmPatients]![cboTitleofCourtesy],1)
in the Picture control.
Below is the function which DOES actually returns a valid file
location such as:
c:\Pictures\pic01.jpg
The Picture control seems to only accept an actual file location and
not an expression.
What am I missing?
Thanks in advance to all you pro's.
Here's the Function, which when tested in the Immediate Window works
perfectly:
Function fPictureFiles(strDir As String, lngPictureNumber As Long) As
String
Dim fs As Object
Set fs = Application.FileSearch
With fs
.LookIn = strDir
.FileName = "*.*"
If .Execute > 0 Then
For i = 1 To .FoundFiles.Count
If i = lngPictureNumber Then
fPictureFiles = .FoundFiles(i)
End If
Next i
Else
MsgBox "There were no files found."
End If
End With
Set fs = Nothing
End Function