I am writing a macro in Project 2007 that compares dates against activeproject.currentdate. One works as expected, another does not. Looking at the watch window shows that activeproject.current date is a Variant/Date, and my other two date fields are of type Date. The Watch window shows:
Watch : : ActiveProject.CurrentDate : 1/20/2014 8:00:00 AM : Variant/Date : Module1.dailypeopleSync
Watch : : asStored(z).FromDate : 1/20/2014 : Date : Module1.dailypeopleSync
Watch : : asStored(z).ToDate : 1/20/2014 : Date : Module1.dailypeopleSync
But in the Immediate Window I get the following:
? asStored(z).FromDate <= ActiveProject.CurrentDate
True
? asStored(z).ToDate >= ActiveProject.CurrentDate
False
Since boh date fields are of Type Date, and the date stored in all three fields is 1/20/2014, why is the secind comparison False?
Is there a way to convert the currentdate variable from a variant to a Date, so I would be comparing apples to apples? CDate seems to still return a date/time. see below:
Watch : : CDate(ActiveProject.CurrentDate) : 1/20/2014 8:00:00 AM : Date : Module1.dailypeopleSync
When comparing my ToDate variable against the CDate(activeproject.urrentdate) I still get a false.
Thanks in advance for your help,