303factory
Registered User.
- Local time
- Today, 09:55
- Joined
- Oct 10, 2008
- Messages
- 136
Hi people
I've got a bit of a headscratcher
I'm trying to loop backwards through time in 15 minute slots until I match a variable. However the my code doesn't seem to recognise my date variable as 'equal' when it is!
I.e. I step through and when I get to the line:
If I hover the mouse over 't' and 'firstAppointment', they both have exactly the same value as '12/11/2012 14:30:00', but it does not enter the If statement and my code behaves as if they were not equal, either I'm doing this wrong or I've broken maths
Can anyone advise what I'm doing wrong?
Thanks in advance
I've got a bit of a headscratcher
I'm trying to loop backwards through time in 15 minute slots until I match a variable. However the my code doesn't seem to recognise my date variable as 'equal' when it is!
I.e. I step through and when I get to the line:
Code:
If t = firstAppointment Then
If I hover the mouse over 't' and 'firstAppointment', they both have exactly the same value as '12/11/2012 14:30:00', but it does not enter the If statement and my code behaves as if they were not equal, either I'm doing this wrong or I've broken maths
Code:
' t, sessionStart, firstSlot, firstAppointment are all Date variables
' slotlength is an integer
firstSlotFound = False
t = sessionStart
Do While firstSlotFound = False
If t = firstAppointment Then
firstSlot = t
firstSlotFound = True
End If
t = t - TimeSerial(0, slotLength, 0)
Loop
Can anyone advise what I'm doing wrong?
Thanks in advance