I'm developing a training database for my employer using Access 2000. My problem is as follows:
I have a table tblEmployees with employee information. The boss has now requested that employee photographs be included for each employee. The equipment that will be used is a digital camera that will be "docked" to a computer to automatically upload the JPEG's. I need help on how to ensure that the proper photo is associated with the correct employee. I do not need the file names to be changed, but if it's possible, that would be the Holy Grail for this problem.
The computer literacy of the end user will be very low to intermediate at best. I need a "IDIOT PROOF" method to accomplish this and by the way, the camera is not dedicated to this use and the person inputing new employee info may not be the same person who captures/uploads the JPEG.
My solution to this is to create a field in tblEmployee called empPhoto that will store the file name of the picture. I'll have a global constant to provide the path to the appropriate folder where the files will be uploaded to. Using recordsets I would get a list of associated file names (where isnull(tblEmployee.empPhoto)= False) . Based on this information, any .jpg in the folder not in that list would be a new file. The form would have at least 6 unbound image controls that would display the images that need to be linked to an employee (that list comes from isnull(tblEmployee.empPhoto)= True). The association would be driven by a click event of a command button. Another recordset would update the table with the appropriate file name. That's the easy part. What I need help with is how to get a list of all files in a folder (not using explorer) and/or renaming then moving a file from one folder to another folder. Or is there an easier way to do this?
I would like to thank you in advance for any help with this problem.
betway to do this is the filesystem object and fill a list box on a form with these file names.
then from there you can select an item and control what you want to do.
here is code to help you - you will have to modify this to your app
What this code does is diplays all relevant files to a customer ID that are in a folder and displays them in a listbox
My app actually then will open acrobat to display the selected file but that is unimportant here.
Private Sub Combo16_AfterUpdate()
' Find the record that matches the control.
Dim rs As Object
Set rs = Me.RecordsetClone
rs.FindFirst "[CustId] = " & Str(Me![Combo16])
Me.Bookmark = rs.Bookmark
txtcustid = Combo16
' Dimension variables.
Dim fs As Object
Dim i As Integer'
' Declare filesearch object.
Set fs = Application.FileSearch'
' ' Set folder to search. This example assumes that the files reside
' ' in the U:\Documents and Settings\a-fell\Desktop folder.
fs.LookIn = "U:\images\"'
' Set file name to search for. This example assumes that you
' want to search for .txt files.
fs.FileName = Me!txtcustid & "x*" & ".*"''
' Execute the file search, and check to see if the file(s) are
If fs.Execute > 0 Then
' Redimension the array to the number of files found.
' Loop through all found file names and fill the array.
For i = 1 To fs.FoundFiles.Count
myarray(i) = fs.FoundFiles(i)
' Display message if no files were found.
MsgBox "No image files were found", vbExclamation
Me.List0.RowSource = ""
If IsLoaded("forms!frmimageview") Then
Forms!frmimageview!Image1.Picture = ""
' Loop through the array and fill the list box on the UserForm.
If fs.FoundFiles.Count > 1 Then
Me.List0.RowSource = myarray(1)
For i = 2 To fs.FoundFiles.Count
Me.List0.RowSource = Me.List0.RowSource & ";" & myarray(i)
For i = 1 To fs.FoundFiles.Count
Me.List0.RowSource = myarray(i)