Originally Posted by
ranman256
That date means the field has time but no date. Basically the date is zero.
you should keep both together, date/time.
you can always concat date to help it fill.... [date] & " " & [time]
I appreciate the response, but I'm not quite sure what to do with that advice.
The exact value of me.logindatestamp in this case was:
4/26/2017 5:33:35 PM
This was visible within the debugger, so it's definitely pulling that value correctly. Not sure what's making that into a date of 0.
I tried running my code as simply:
Code:
If IsNull(DLookup("[ID]", "[tblDailyQCSamples]", "[CountDate] =" & DateValue(Me.logInDateStamp))) = True Then
DoCmd.RunSQL "INSERT INTO tblDailyQCSamples ( Count, CountDate) SELECT " & Me.noSamples & ", " & Me.logInDateStamp & ";"
Else
DoCmd.RunSQL "UPDATE tblDailyQCSamples SET count = " & DLookup("[count]", "[tblDailyQCSamples]", "[CountDate] =" & Me.logInDateStamp) + Me.noSamples & " WHERE countdate = " & Me.logInDateStamp & ";"
End If
However, i get Syntax Error (missing operator) in query expression '[CountDate] =4/26/2017 5:33:35 PM'. I assume that has to do with the time at the end of that value, which it doesn't know what to do with.
So i tried replacing me.logindatestamp with Format(me.logindatestamp, "Short Time") - no dice, this gets me the 12/30/1899 date again.
So the only thought I have left is the incredibly sloppy:
Code:
DatePart("m", Me.logInDateStamp) & "/" & DatePart("d", Me.logInDateStamp) & "/" & DatePart("y", Me.logInDateStamp)
Which, unfortunately, gets me Syntax error in UPDATE statement... And we've already tried DateValue(), leaving me with no ideas left.