S
Scott
I have a start date and an end date in my project that is defaulted to the current date at run-time using the following code...
Date1.Value = Now()
Date2.Value = Now()
I then have some code that works out the number of days between the 2 dates as follows...
Dim d1, d2 As Date
d1 = Me.Date1.Value
d2 = Me.Date2.Value
Me.TextBox7.Text = CStr(d2.Subtract(d1).Days)
The problem that I am having is if I don't change the first date but change the second date to 1 day from now it doesn't pick up that it is 1 day apart! But if I select the first date physically and change it to the day that is automatically displayed at run time then this works correctly but realising that it is 1 days difference! (hope you understand this!).
Maybe this will help you understand... If the default start date is today 03/03/05 and I change the end date to 04/03/05 then the code still says 0 days difference between the days. But if I physically select 03/03/05 as the start date and select 04/03/05 as the end date then the code tells me that the difference is 1 day!???
Why is this code not working correctly in this instance and is there a work-around???
Hope you all understand
Regards Scott
Date1.Value = Now()
Date2.Value = Now()
I then have some code that works out the number of days between the 2 dates as follows...
Dim d1, d2 As Date
d1 = Me.Date1.Value
d2 = Me.Date2.Value
Me.TextBox7.Text = CStr(d2.Subtract(d1).Days)
The problem that I am having is if I don't change the first date but change the second date to 1 day from now it doesn't pick up that it is 1 day apart! But if I select the first date physically and change it to the day that is automatically displayed at run time then this works correctly but realising that it is 1 days difference! (hope you understand this!).
Maybe this will help you understand... If the default start date is today 03/03/05 and I change the end date to 04/03/05 then the code still says 0 days difference between the days. But if I physically select 03/03/05 as the start date and select 04/03/05 as the end date then the code tells me that the difference is 1 day!???
Why is this code not working correctly in this instance and is there a work-around???
Hope you all understand
Regards Scott