- Create an Unbound Image control (select it from the toolbox and draw it on the Form in the required size) on the Employees Form.
- Change it's Name Property value to Photo.
- Copy and paste the following VBA Code into the Employees Form VBA Module:
Code:
Private Sub Form_Current()
Dim ximg, path
path = "C:\picturefolder\"
ximg = Me![employeenumber]
Me.Photo.Picture = path & ximg & ".jpg"
End Sub
Correct the above Code whereever change required to match the foldername, employeenumber etc.
When you move the employee records on the Form one after the other their pictures will appear on the Photo control automatically. The picture name should match the employee number with .jpg file extension like: 12345.jpg.
Learn another trick with pictures from this link: Run Slide Show when the Form is idle