Query Date Range within a date Range (1 Viewer)

Mick99

New member
Local time
Today, 12:47
Joined
Feb 19, 2016
Messages
14
Hi All,

I have a number of actions with start and finish dates. The issue is that I want to view a certain period within these dates and I cant seem to figure out how to do this. I have a form that allows to user to select the particular week they need to view, however the query only returns records that have dates in the range and don't allow for targeting dates in the range inside the range, if that makes sense.
 

theDBguy

I’m here to help
Staff member
Local time
Today, 12:47
Joined
Oct 29, 2018
Messages
21,467
Hi. Have you tried maybe something like this? Just curious...
Code:
...WHERE StartDateField<=[RangeEnd] And EndDateField>=[RangeStart]
(untested)
 
Last edited:

Mick99

New member
Local time
Today, 12:47
Joined
Feb 19, 2016
Messages
14
No I havn't would that work in a query, I'll give it a go.

Cheers Mick
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Tomorrow, 03:47
Joined
May 7, 2009
Messages
19,230
you need to use the Form's control on your Query:

select * from yourTable Where dateField between [Forms]![yourFormName]![startDateControl] And [Forms]![yourFormName]![endDateControl]
 

Mick99

New member
Local time
Today, 12:47
Joined
Feb 19, 2016
Messages
14
Hi [U]theDBguy[/U] , this seems to have done the trick. Thankyou!!! :)

RESULTS_FILTER: [WP_Activity_Start]<[Forms]![frm_Report_Selection]![Week_End] And [WP_Activity_Finish]>[Forms]![frm_Report_Selection]![Week_Start]
 

theDBguy

I’m here to help
Staff member
Local time
Today, 12:47
Joined
Oct 29, 2018
Messages
21,467
Hi [U]theDBguy[/U] , this seems to have done the trick. Thankyou!!! :)

RESULTS_FILTER: [WP_Activity_Start]<[Forms]![frm_Report_Selection]![Week_End] And [WP_Activity_Finish]>[Forms]![frm_Report_Selection]![Week_Start]
Oh, was it a false alarm then? Glad to hear you got it sorted out. Good luck with your project.
 

Users who are viewing this thread

Top Bottom