I am using Access 2010 and Windows 7
I want to programmatically delete files that are more than 10 days old from a folder using MS Access VBA. I am using the filesystemobject but I am either not coding it correctly or am missing a reference library. I have not even put in the date compare code because I can't seem to get the date created. I get a file not found error on the dteCreate = fileOb.GetFile(fileNme).DateCreated line.
Dim fileOb As Object
Dim fileNme As String
Dim path As String
Dim dteCreate As String
Dim FileGet As String
Set fileOb = CreateObject("Scripting.FileSystemObject")
path = "\\Cust\DeptFiles$\pol\Shop\TopCust\"
fileNme = Dir(path)
Do While (fileNme <> "")
If InStr(fileNme, "RptRecentContact") > 0 Then
FileGet = fileOb.GetFileName(fileNme)
dteCreate = fileOb.GetFile(fileNme).DateCreated
' Kill fileName
' End If