Short story: Adding 30 min to 2:00 PM doesn't equal 2:30 PM.
Try this code:
Output: 11/21/2013 2:30:00 PM <> 11/21/2013 2:30:00 PM
You can insert these two equal date/time values into at table indexed to not allow duplicates in that field.
I tried creating the dates by using DateSerial and DateAdd, same result.
Adding 1 min to both times (2:01, 2:31) will produce correct output.
I presume floating numbers are playing a role here, but how can this be dealt with?
MS Access 2010, 2003 and 97.
Try this code:
Code:
Dim dTemp1 As Date
Dim dTemp2 As Date
dTemp1 = #11/21/2013 2:30:00 PM#
dTemp2 = #11/21/2013 2:00:00 PM#
dTemp2 = DateAdd("n", 30, dTemp2)
If dTemp1 = dTemp2 Then
Debug.Print "ok"
Else
Debug.Print dTemp1 & " <> " & dTemp2
End If
You can insert these two equal date/time values into at table indexed to not allow duplicates in that field.
I tried creating the dates by using DateSerial and DateAdd, same result.
Adding 1 min to both times (2:01, 2:31) will produce correct output.
I presume floating numbers are playing a role here, but how can this be dealt with?
MS Access 2010, 2003 and 97.
Comment