alihussain
New member
- Local time
- Today, 23:50
- Joined
- Jul 1, 2020
- Messages
- 19
Hi,
I created a table which called Table1 to contain 2 fields ID= auto number & Path=long text, then i created a form on it ID, Path, and command button which will function returns the path of files
Nothing happens after I run this code I hope u guys help me with this.
I created a table which called Table1 to contain 2 fields ID= auto number & Path=long text, then i created a form on it ID, Path, and command button which will function returns the path of files
Code:
Private Sub Command10_Click()
On Error Resume Next
Dim fso As New Scripting.FileSystemObject
Dim folder As Scripting.folder
Dim file As Scripting.file
Dim fileList As Scripting.Files
Dim fullPath As String
dim folderPath as string
folderPath = "d:\scan"
Set folder = fso.GetFolder(folderPath)
Set fileList = folder.Files
For Each file In fileList
fullPath = folder.path & "\" & file.Name
Dim Ttb2 As Recordset
Set Ttb2 = CurrentDb.OpenRecordset("Table1")
Ttb2.AddNew
Ttb2![ID] = Forms![Table1]![ID]
Ttb2![path] = fullPath
Ttb2.Update
Next file
End Function
Nothing happens after I run this code I hope u guys help me with this.
Last edited: