Time filter in query (1 Viewer)

accessonly11

Member
Local time
Today, 05:46
Joined
Aug 20, 2022
Messages
91
dear access users,

I can filter date by using this expression on date field
Between [Forms]![ShiftReportF]![StartDate] And [Forms]![ShiftReportF]![EndDate]+1

but what express is to used to filter time, i already extracted time using timevalue.
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 08:46
Joined
May 7, 2009
Messages
19,247
you can use the same with your time field:

TimeValue([TimeField]) Between TimeValue([Forms]![ShiftReportF]![StartTime]) And TimeValue([Forms]![ShiftReportF]![EndTime])
 

accessonly11

Member
Local time
Today, 05:46
Joined
Aug 20, 2022
Messages
91
i put this expression in query grid,
1673361376152.png


but facing this error

1673361533321.png
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 08:46
Joined
May 7, 2009
Messages
19,247
you may try adding two "hidden" textbox to your form that retrieve the TimeValue of [StartTime] and [EndTime]
eg: (txtStartTime)
ControlSource: = TimeValue([StartTime])

(txtEndTime)
ControlSource: = TimeValue([EndTime])

now on your query use these hidden txtbox as criteria:

Between [Forms]![ShiftReportF]![txtStartTime] And [Forms]![ShiftReportF]![txtEndTime]
 

Users who are viewing this thread

Top Bottom