J
John
I need some code help in getting the file names from C:\MyFolder\
and then adding names to an accessTable
and then adding names to an accessTable
John said:Thank you . . thank you . . .
can I also get property information such as [Name] and [Date Modified]
Brendan Reynolds said:You can, but that would require very different techniques. One possible
solution would be to use the Microsoft Scripting Runtime Object Library.
There's some documentation on this library at the following URL. The
documentation refers to Office XP, but to the best of my knowledge it
would be equally applicable to Office 2000 or Office 2003.
http://msdn.microsoft.com/library/d...themicrosoftscriptingruntimeobjectlibrary.asp
--
Brendan Reynolds (MVP)
John said:Thank you . . thank you . . .
can I also get property information such as [Name] and [Date Modified]
Brendan Reynolds said:Public Sub ReadFiles()
Dim strPath As String
Dim db As DAO.Database
Dim rst As DAO.Recordset
Dim strFile As String
Set db = CurrentDb
Set rst = db.OpenRecordset("tblTest", dbOpenDynaset, dbAppendOnly)
strPath = "C:\DSDATA\*.*"
strFile = Dir(strPath)
Do While strFile <> vbNullString
rst.AddNew
rst.Fields("TestText") = strFile
rst.Update
strFile = Dir()
Loop
rst.Close
End Sub
--
Brendan Reynolds (MVP)
I need some code help in getting the file names from C:\MyFolder\
and then adding names to an accessTable
Douglas J. Steele said:That may be overkill, Brendan.
Your technique is already returning the file's Name property, and the VBA
FileDateTime function will return its Last Modified timestamp:
Do While Len(strFile) > 0
rst.AddNew
rst.Fields("TestText") = strFile
rst.Fields("LastModified") = _
FileDateTime("C:\DSDATA\" & strFile)
rst.Update
strFile = Dir()
Loop
--
Doug Steele, Microsoft Access MVP
(no e-mails, please!)
Brendan Reynolds said:You can, but that would require very different techniques. One possible
solution would be to use the Microsoft Scripting Runtime Object Library.
There's some documentation on this library at the following URL. The
documentation refers to Office XP, but to the best of my knowledge it
would be equally applicable to Office 2000 or Office 2003.
http://msdn.microsoft.com/library/d...themicrosoftscriptingruntimeobjectlibrary.asp
--
Brendan Reynolds (MVP)
John said:Thank you . . thank you . . .
can I also get property information such as [Name] and [Date Modified]
"Brendan Reynolds" <anonymous at discussions dot microsoft dot com>
wrote in message Public Sub ReadFiles()
Dim strPath As String
Dim db As DAO.Database
Dim rst As DAO.Recordset
Dim strFile As String
Set db = CurrentDb
Set rst = db.OpenRecordset("tblTest", dbOpenDynaset, dbAppendOnly)
strPath = "C:\DSDATA\*.*"
strFile = Dir(strPath)
Do While strFile <> vbNullString
rst.AddNew
rst.Fields("TestText") = strFile
rst.Update
strFile = Dir()
Loop
rst.Close
End Sub
--
Brendan Reynolds (MVP)
I need some code help in getting the file names from C:\MyFolder\
and then adding names to an accessTable