M
Martin Watts
I'm being dense or just can't see the woods for the trees.
I have a table which holds details of the start and end dates of training
courses. I have a query which uses a parameter from a form to select
courses running in any chosen year and have an calculated field to determine
if the course is running in quarter 2 of that year but it's returning
incorrect results and I just cannot see what is wrong with the expression.
The fields in the query are
YRQTRST - The year and qtr in which the course starts e.g. 13 for courses
starting in the 3rd quarter of year 1
YRQTREND - As above but the year and quarter in which the course ends
YRSTART - The year in which the course starts
YREND - The year in which the course ends
CURRENT - Should return "Running" or "Not Running" if the course is running
in the second quarter of any selected year
YRQTRST and YRQTREND are calculated in an update query which 'feeds' the
table upon which this query is based. This same update query also contains
the parameters for selecting the year in which the course starts and ends
(YRSTART & YREND). The parameters are for YRSTART
<=[Forms]![frmSelectYr]![txtYear] and for YREND
The expression in the calculated field is as follows:
CURRENT: IIf([YRQTRST]<=[YRSTART] & 2 And [YRQTREND]>=[YREND] &
2,"RUNNING","NOT RUNNING")
However the query returns typical results such as below (in this case when
year "1" is selected)
YRSTART YREND YRQTRST YRQTREND CURRENT
1 2 12 21
NOT RUNNING
1 2 14 21
RUNNING
Some of the results returned are perfectly correct, but I'm sure there is
something wrong with the expression.
Help.
TIA
Martin Watts
I have a table which holds details of the start and end dates of training
courses. I have a query which uses a parameter from a form to select
courses running in any chosen year and have an calculated field to determine
if the course is running in quarter 2 of that year but it's returning
incorrect results and I just cannot see what is wrong with the expression.
The fields in the query are
YRQTRST - The year and qtr in which the course starts e.g. 13 for courses
starting in the 3rd quarter of year 1
YRQTREND - As above but the year and quarter in which the course ends
YRSTART - The year in which the course starts
YREND - The year in which the course ends
CURRENT - Should return "Running" or "Not Running" if the course is running
in the second quarter of any selected year
YRQTRST and YRQTREND are calculated in an update query which 'feeds' the
table upon which this query is based. This same update query also contains
the parameters for selecting the year in which the course starts and ends
(YRSTART & YREND). The parameters are for YRSTART
<=[Forms]![frmSelectYr]![txtYear] and for YREND
=[Forms]![frmSelectYr]![txtYear] and these seem to be working fine.
The expression in the calculated field is as follows:
CURRENT: IIf([YRQTRST]<=[YRSTART] & 2 And [YRQTREND]>=[YREND] &
2,"RUNNING","NOT RUNNING")
However the query returns typical results such as below (in this case when
year "1" is selected)
YRSTART YREND YRQTRST YRQTREND CURRENT
1 2 12 21
NOT RUNNING
1 2 14 21
RUNNING
Some of the results returned are perfectly correct, but I'm sure there is
something wrong with the expression.
Help.
TIA
Martin Watts