Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Date+Time greater than or equal to FileDateTime

Status
Not open for further replies.

brumo

Technical User
May 30, 2008
15
0
0
US
I didn't expect this to work, but under certain condtions it seems to. When I set the datevalue to (Date()-2) or +20, which is next month, it works. The filedatetime is (06/07/2008 5:32:44 PM).
Code:
Sub main

   CurrFile=DateValue(Date()-2) & " "  & TimeValue(Time())
   PrevFile=FileDateTime("h:\" & Format(Date-1, "mm.dd.yy") & "_excel ccmbalance.xls")
    
   If CurrFile<=PrevFile then
   MsgBox CurrFile & " " & "Less than or equal to" & " " & PrevFile
   End If
   
   If CurrFile>=PrevFile then
   MsgBox CurrFile & " " & "Greater than or equal to" & " " & PrevFile
   End If

End Sub
 
Got it. Changing the CurrFile value seems to make a difference.
Code:
   CurrFile=(DateValue(Date()) + TimeValue(Time()))
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top