N
Noel
Hi. I recently had good replies from Pavel and Cheryl
about a similar question to this but I now realise that my
question is more complicated than I thought. I want to
select records in a query based on the values in a date
field. The problem is twofold. I need to select records
where the values in the date field are between 1 September
in one year and 30 August the following year (i.e. roughly
the span of an academic year). Also, the first years value
needs to be taken from a table and is given by the result
of the following DLookup
=DLookU("[PlacementStartYear]","[tblPlacementStartYear]")
tblPlacementStartYear has just one record with just one
field so a WHERE statement is not needed here.
The users change the value of PlacementStartYear each
September and it is currently set to 2003. So if I can
build the DLookup into the queries criteria somehow, it
could be made to automatically work out the year values
for the current academic year (i.e. between the DLookup
value and DLookup plus one) and the query will not need to
be changed each year.
So, just to labour the point, if the query ran today it
would select records where the date field is between 1
September 2003 and 30 August 2004. If it was run next
April, it would select records where the date field was
between 1 September 2004 and 30 August 2005, because by
then the users would have changed the PlacementStartYear
value to 2004.
So in a crude way the query criteria for the date field
would look something like
Between 1 September (DLookup value) And 30 August (DLookup
value plus one)
How could I build a query criteria to do this? Thanks, Noel
about a similar question to this but I now realise that my
question is more complicated than I thought. I want to
select records in a query based on the values in a date
field. The problem is twofold. I need to select records
where the values in the date field are between 1 September
in one year and 30 August the following year (i.e. roughly
the span of an academic year). Also, the first years value
needs to be taken from a table and is given by the result
of the following DLookup
=DLookU("[PlacementStartYear]","[tblPlacementStartYear]")
tblPlacementStartYear has just one record with just one
field so a WHERE statement is not needed here.
The users change the value of PlacementStartYear each
September and it is currently set to 2003. So if I can
build the DLookup into the queries criteria somehow, it
could be made to automatically work out the year values
for the current academic year (i.e. between the DLookup
value and DLookup plus one) and the query will not need to
be changed each year.
So, just to labour the point, if the query ran today it
would select records where the date field is between 1
September 2003 and 30 August 2004. If it was run next
April, it would select records where the date field was
between 1 September 2004 and 30 August 2005, because by
then the users would have changed the PlacementStartYear
value to 2004.
So in a crude way the query criteria for the date field
would look something like
Between 1 September (DLookup value) And 30 August (DLookup
value plus one)
How could I build a query criteria to do this? Thanks, Noel