Gasman
Enthusiastic Amateur
- Local time
- Today, 16:46
- Joined
- Sep 21, 2011
- Messages
- 16,599
I need to lookup a field that holds date and time, but with only the date part.
So I used a constant that I use all the time
My code was
but that produces a date of 0tr30/04/2025Jet30ate ???
So I tried using a variable
but get the same value?
If I try in the Immediate Window with todays date
So what is going on? Any ideas please?
Field is DateTime and a Short Date.
So I used a constant that I use all the time
Code:
Public Const strcJetDate = "\#yyyy-mm-dd\#" 'Needed for dates in queries as Access expects USA but will accept ISO format.
My code was
Code:
Me.BloodPressure = DMin("Systolic", "tblPressure", "DateValue(PressureDateTime) = " & Format(Me.HealthDate, "strcJetDate"))
So I tried using a variable
Code:
Dim strDate As String
strDate = Format(Me.HealthDate, "strcJetDate")
Me.BloodPressure = DMin("Systolic", "tblPressure", "DateValue(PressureDateTime) = " & strDate)
If I try in the Immediate Window with todays date
Code:
? format(date,strcJetDate)
#2025-04-30#
So what is going on? Any ideas please?
Field is DateTime and a Short Date.