Ok so I changed my code to this to compare like data values (or at least tired to) still no copy
My values were My week day 7=7 and MMyTime = 9:15:00 PM > 12:00:00 PM
Would this seem to be correct?
Code:
Option Compare Database
Option Explicit
Function DocPurge()
Dim DDate, strfile As String
Dim LMsg, LMsg2 As String
Dim DDDate, ThisDay As Date
Dim MyDate, MyWeekDay
Dim MyTime, MMyTime, MMMyTime
ChDir ("K:\System Reports")
strfile = Dir("K:\System Reports\SDC1201S SDC185S???????????????????????????????????.pdf")
'** Step 2 -- Begin the loop process.
Do While Len(strfile) > 0
DoCmd.SetWarnings True
DDate = Mid(strfile, 41, 2) & "/" & Mid(strfile, 43, 2) & "/" & Mid(strfile, 39, 2)
DDDate = DDate ' This got the date from the file name.
MyDate = DDDate
' Assign a date.
MyWeekDay = Weekday(MyDate)
' MyWeekDay contains 4 because
' MyDate represents a Wednesday.
MyTime = Mid(strfile, 46, 2) & ":" & Mid(strfile, 48, 2) & ":00"
MMyTime = TimeValue(MyTime)
''MMyTime = Format(MyTime, "mm/dd/yyyy hh:nn:ss am/pm")
MMMyTime = TimeValue("12:00:00")
If MyWeekDay = 7 And MMyTime > MMMyTime Then
FileCopy "K:\System Reports" & strfile, "K:\Teams and Projects\Processing Reports\SDC185_Report_History" & strfile
End If
strfile = Dir
Loop
'' DoCmd.SetWarnings True
End Function
Thanks,
Nick