Lord Justin
Registered User.
- Local time
- Today, 18:55
- Joined
- Oct 15, 2007
- Messages
- 15
Hi,
I want to add folder names to my table. Without duplicate. But how? Here is the my code:
Dim FSO As New FileSystemObject
Dim f As Folder, sf As Folder
If FSO.FolderExists("C:\Test") Then
Set f = FSO.GetFolder("C:\Test\")
If Not f.SubFolders.Count = 0 Then
For Each sf In f.SubFolders
if not sf.Name in TestTable.TestField (Of course this code is not working. This is only a reference. Any idea for it? What can I replace it with?)
CurrentDb.Execute "INSERT INTO TestTable (TestField) VALUES('" & sf.Name & "')", dbFailOnError
Next
End If
End If
I want to add folder names to my table. Without duplicate. But how? Here is the my code:
Dim FSO As New FileSystemObject
Dim f As Folder, sf As Folder
If FSO.FolderExists("C:\Test") Then
Set f = FSO.GetFolder("C:\Test\")
If Not f.SubFolders.Count = 0 Then
For Each sf In f.SubFolders
if not sf.Name in TestTable.TestField (Of course this code is not working. This is only a reference. Any idea for it? What can I replace it with?)
CurrentDb.Execute "INSERT INTO TestTable (TestField) VALUES('" & sf.Name & "')", dbFailOnError
Next
End If
End If