Hi,
I'm using the following code to look through folders/subfolders and create a table using the file names and paths. I get the error "Compile error: User-defined type not defined".
I had the MS DAO 3.6 Object Library checked in references along with VB for Applications, Access Object Library and OLE Automation.
I'm running this from the Immediate Window using
Can anyone offer any suggestions on what needs to be fixed?
I'm using the following code to look through folders/subfolders and create a table using the file names and paths. I get the error "Compile error: User-defined type not defined".
Code:
Option Explicit
Public Function AppendFileList(strFolder As String, IncludeSubFolders As Boolean)
On Error GoTo errHandler
Dim objFSO As FileSystemObject
Dim objFolder As Folder
Dim objFiles As File
Dim strFileNames As String
Dim strSubFolder As Folder
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFolder = objFSO.GetFolder(strFolder)
For Each objFields In objFolder.Files
DoCmd.SetWarnings False
strCount = strCount + 1
DoCmd.RunSQL ("Insert Into TblFileList Values('" & objFiles.Name & "','" & objFolder.Path & "';")
DoCmd.SetWarnings True
DoEvents
strFilesFound = strFilesFound & vbCrLf & objFiles.Name
Next
If IncludeSubFolders = True Then
For Each strSubFolder In objFolder.SubFolders
Call AppendFileList(strSubFolder.Path, True)
Next
End If
I had the MS DAO 3.6 Object Library checked in references along with VB for Applications, Access Object Library and OLE Automation.
I'm running this from the Immediate Window using
Code:
?appendfilelist ("c:\3d\final\tat", "False")
Can anyone offer any suggestions on what needs to be fixed?