What is it with these dates? What are they so much trouble? All I want to
do is subtract an hour, but not if that makes dtmTest less than dtmClt.
Dim dtmStart As Date
Dim dtmEnd As Date
Dim dtmCtl As Date
Dim dtmTest As Date
Me!cbxEndTime.Requery
Me!cbxStartTime.Requery
dtmStart = #1/1/1000# & " " & Me!cbxStartTime
dtmEnd = #1/1/1000# & " " & Me!cbxEndTime
dtmCtl = #1/1/1000# & " " & "12:00 AM"
dtmTest = DateAdd("h", -1, dtmEnd)
Debug.Print Format((dtmStart), "m/d/yyyy h:nn am/pm") & " = start"
Debug.Print Format((dtmEnd), "m/d/yyyy h:nn am/pm") & " = end"
Debug.Print Format((dtmCtl), "m/d/yyyy h:nn am/pm") & " = control"
Debug.Print Format((dtmTest), "m/d/yyyy h:nn am/pm") & " = test"
Debug.Print
If t = "start" Then
If dtmTest < dtmCtl Then
Debug.Print Format((dtmTest), "m/d/yyyy h:nn am/pm")
Debug.Print "is less than"
Debug.Print Format((dtmCtl), "m/d/yyyy h:nn am/pm")
FixTime = Format(TimeValue(dtmEnd), "h:nn am/pm")
Else
FixTime = Format(TimeValue(DateAdd("h", -1, dtmEnd)), "h:nn am/pm")
End If
End If
[output]
1/1/1000 4:30 am = start
1/1/1000 4:00 am = end
1/1/1000 12:00 am = control
1/1/1000 3:00 am = test
1/1/1000 3:00 am
is less than
1/1/1000 12:00 am
But dtmTest is NOT less than dtmCtl.... why all the drama? Seems too high
maintenance for me.