-
OK, I am not sure of this helps or not, as I think that the code that I supplied doees most of what you want, ie find the CheckFile that matches your list file, but I now have the code to establish the date of the file and the routine will which is the oldest file in the folder with the Checklist name.
This is the code
Dim CheckFile, FileFound As String, AllOk As Boolean, i As Integer, ErrMsg As String
Dim sDest As String, strFileTemp As String, FileExist As String, filed As Date, firstfile As String, firstfiled As Date
Dim ctlList As Control, varItem As Integer, posn As Integer, FileName As String
CheckFile = Array("*TESTMAIN*.*", "*TESTCASE*.*", "*TESTPRIMARY*", "*TESTSECONDARY*", "*TESTALTERNATE*")
On Error GoTo errorcatch
'The following lines of code use a network path for the source file :
sDest = "C:\Users\A C\Downloads\" & CheckFile(0) ' will be changed to CurrentProject.path & MAXIMOExports
MsgBox sDest
Dim ctr As Integer
ctr = 1
FileFound = Dir(sDest) ' Retrieving the first entry.
If FileFound <> "" Then
firstfile = FileFound
filed = FileDateTime("C:\Users\A C\Downloads\" & FileFound)
firstfiled = filed
MsgBox ctr & " - " & FileFound & " dated - " & filed
End If
Do Until FileFound = "" ' Start the loop.
ctr = ctr + 1
FileFound = Dir() ' Getting next entry.
If FileFound <> "" Then
filed = FileDateTime("C:\Users\A C\Downloads\" & FileFound)
If filed < firstfiled Then
firstfiled = filed
firstfile = FileFound
End If
MsgBox ctr & " - " & FileFound & " dated - " & filed
End If
Loop
MsgBox firstfile & " dated - " & firstfiled
Exit Sub
So I assume that having established the correct master file you will open it for appending, open your List file for reading and append it's data to the master file. Or if no file is found you will just copy the list file in to the folder with the extension new "text.dat" name.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules