I have on my computer a folder with all the pictures of members.
I have made a form with the personal information of each of them, I can not link the picture manually because their are too many.
The members have a member number, the picture has the same number.( 1012.jpg )
How can I visualize the picture in the form.
( access 2013 )
Scan the folder of photos , each photo name is the member id
load the photo path, or actual photo into db.
Public Sub ScanAllFilesInDir()
Dim fso, oFolder, oFile, vDir, vFile
vDir = "Z:\Users\photos\"
Set fso = CreateObject("Scripting.FileSystemObject")
Set oFolder = fso.GetFolder(vDir)
For Each oFile In oFolder.Files
vFile = vDir & oFile.Name
If InStr(vFile, ".jpg") > 0 Then 'ONLY get JPG files
vMemNum = Left(oFile.Name, Len(oFile.Name) - 4)
Me.Filter = "[MemberID]=" & vMemNum
Me.FilterOn = True
If txtMemberID= vMemNum Then
txtPhotoPath = vFile 'LOAD THE PATH TO THE PHOTO
' Img.SourceDoc = (vFile) 'LOAD THE PHOTO to BOUND OLE OBJECT field
' Img.Action = acOLECreateEmbed
Set fso = Nothing
Set oFile = Nothing
Set oFolder = Nothing