I have a macro that imports information for an Access file. What I am try to accomplish is when I run this macro to check if the Access file is as of yesterdays date. I've created the below, but it always runs as Moddate <> Testdate when I know it is not true. The other issue is, when the msgbox pops up and I say "yes" it will message is still gives "you said no." Any assistance would be appreciated.
Code:
Sub moddate1()
Dim Moddate As Date
Dim Testdate As Date
Moddate = Format(FileDateTime("C:\temp\Reports\report.mdb"), "mm/dd/yyyy")
Testdate = Format((Date - 1), "dd/mm/yyyy")
If Moddate <> Testdate And MsgBox("Report is out of date. Continue?", vbYesNo) = vbYes Then
MsgBox ("you said yes")
Else
MsgBox ("you said no")
Exit Sub
End If
'rest of macro runs from here formating and such without problem.....
End Sub