G
GiBB
Hello,
I am trying to create a query to search for various date ranges in a table.
to make it easier for the user i am trying to create the query so they only
need to open one query which shows pop ups for "start dates for field one"
"end dates for field one" "start dates for field two" "end dated for field
two" etc and if they only enter details in one set of pop ups (say they only
fill in the start and end dates for field one and left two, three and four
blank) it will on display results for that set of ranges only.
my sql is as follows:
SELECT ChangeDetails.[Change ID], ChangeDetails.Region, ChangeDetails.Corp,
ChangeDetails.Priority, ChangeDetails.System, ChangeDetails.FunctionalArea,
ChangeDetails.[Changes Made], ChangeDetails.[Authorised By],
ChangeDetails.[Authorised Date], ChangeDetails.[1st Checker],
ChangeDetails.[1st Check Date], ChangeDetails.[2nd Checker],
ChangeDetails.[2nd check Date], ChangeDetails.Implemented,
ChangeDetails.ImplementedDate, ChangeDetails.[Detail Attached],
ChangeDetails.[Details of Change]
FROM ChangeDetails
WHERE
(((ChangeDetails.[Authorised Date]) Between [Requested start date] And
[Requested end date]) or (([Requested start date]) Is Null) and (([Requested
end date]) Is Null)
and
(((ChangeDetails.[1st Check Date]) Between [First check start date] And
[First check end date])) or (([First check start date]) Is Null) and
(([First check end date]) Is Null)
and
(((ChangeDetails.[2nd check Date]) Between [Second check start date] And
[Second check end date])) or (([Second check start date]) Is Null) and
(([Second check end date]) Is Null)
and
(((ChangeDetails.ImplementedDate) Between [Done date start] And [Done date
end])) or (([Done date start]) Is Null) AND (([Done date end]) Is Null))
which it is partialy doing what i want as in i can search for all four field
ranges at once, however if i leave any of the popups blank it will either
show all the records in the table or it will not show any records at all even
if i define criteria which should only bring up one "test" record.
please help.
Cheers
I am trying to create a query to search for various date ranges in a table.
to make it easier for the user i am trying to create the query so they only
need to open one query which shows pop ups for "start dates for field one"
"end dates for field one" "start dates for field two" "end dated for field
two" etc and if they only enter details in one set of pop ups (say they only
fill in the start and end dates for field one and left two, three and four
blank) it will on display results for that set of ranges only.
my sql is as follows:
SELECT ChangeDetails.[Change ID], ChangeDetails.Region, ChangeDetails.Corp,
ChangeDetails.Priority, ChangeDetails.System, ChangeDetails.FunctionalArea,
ChangeDetails.[Changes Made], ChangeDetails.[Authorised By],
ChangeDetails.[Authorised Date], ChangeDetails.[1st Checker],
ChangeDetails.[1st Check Date], ChangeDetails.[2nd Checker],
ChangeDetails.[2nd check Date], ChangeDetails.Implemented,
ChangeDetails.ImplementedDate, ChangeDetails.[Detail Attached],
ChangeDetails.[Details of Change]
FROM ChangeDetails
WHERE
(((ChangeDetails.[Authorised Date]) Between [Requested start date] And
[Requested end date]) or (([Requested start date]) Is Null) and (([Requested
end date]) Is Null)
and
(((ChangeDetails.[1st Check Date]) Between [First check start date] And
[First check end date])) or (([First check start date]) Is Null) and
(([First check end date]) Is Null)
and
(((ChangeDetails.[2nd check Date]) Between [Second check start date] And
[Second check end date])) or (([Second check start date]) Is Null) and
(([Second check end date]) Is Null)
and
(((ChangeDetails.ImplementedDate) Between [Done date start] And [Done date
end])) or (([Done date start]) Is Null) AND (([Done date end]) Is Null))
which it is partialy doing what i want as in i can search for all four field
ranges at once, however if i leave any of the popups blank it will either
show all the records in the table or it will not show any records at all even
if i define criteria which should only bring up one "test" record.
please help.
Cheers