I am using Allen Browne's code to get file names.
/ Thanks, Allen
I would appreciate help in editing it so that the full path is in one field. Also, although I can probably figure it out eventually, it would be good if someone can write the code that will truncate the file name to the last 5 characters before the file type -- in other words, each file will have a 5 character file 'number' at the end -- such as ' 51003.pdf '. I need the 51003 in a separate field so that I end up with a table:
51003 | C:\Data\ABC.Lease.20110902.51003.pdf
here's the snippet I need help with.....
Dim strTemp As String
Dim colFolders As New Collection
Dim vFolderName As Variant
Dim strSql As String
'Add the files to the folder.
strFolder = TrailingSlash(strFolder)
strTemp = dir(strFolder & strFileSpec)
gCount = 0
Do While strTemp <> vbNullString
gCount = gCount + 1
SysCmd acSysCmdSetStatus, gCount
strSql = "INSERT INTO myFiles " _
& " (FName, FPath) " _
& " SELECT """ & strTemp & """" _
& ", """ & strFolder & """;"
CurrentDb.Execute strSql
colDirList.Add strFolder & strTemp
strTemp = dir
Loop
Thank you!!
/ Thanks, Allen
I would appreciate help in editing it so that the full path is in one field. Also, although I can probably figure it out eventually, it would be good if someone can write the code that will truncate the file name to the last 5 characters before the file type -- in other words, each file will have a 5 character file 'number' at the end -- such as ' 51003.pdf '. I need the 51003 in a separate field so that I end up with a table:
51003 | C:\Data\ABC.Lease.20110902.51003.pdf
here's the snippet I need help with.....
Dim strTemp As String
Dim colFolders As New Collection
Dim vFolderName As Variant
Dim strSql As String
'Add the files to the folder.
strFolder = TrailingSlash(strFolder)
strTemp = dir(strFolder & strFileSpec)
gCount = 0
Do While strTemp <> vbNullString
gCount = gCount + 1
SysCmd acSysCmdSetStatus, gCount
strSql = "INSERT INTO myFiles " _
& " (FName, FPath) " _
& " SELECT """ & strTemp & """" _
& ", """ & strFolder & """;"
CurrentDb.Execute strSql
colDirList.Add strFolder & strTemp
strTemp = dir
Loop
Thank you!!