J
JessiRight77
I need to pull all "year-to-date" values for a product, and I am having
a hard time composing the criteria for the query.
The "year" that I need to reference is stored in another query column
called YearProd, which uses the DatePart command to extract the year
from a date range entered by me on a search criteria dialog box. When
I run the query, YearProd correctly displays the year of whatever date
I typed in the dialog box.
Now, I want to add the values of all products made for the year of a
date that was entered in the search criteria dialog box.
This is what I originally entered as the criteria for fldDate:
Between 1/1/YearProd And Now()
But after I tab out of the criteria field, it translates it into the
following (because 2005 happened to be the current value of YearProd):
Between #1/1/05#/"YearProd" And Now()
Then when I run the query, I get an error message that says my query is
either typed incorrectly or too complex.
Am I using the wrong syntax, or can this even be done? Does anyone
know how to create an expression for a date field in a query that
references the year that is stored in another column of that same
query?
Thanks,
Jessi
a hard time composing the criteria for the query.
The "year" that I need to reference is stored in another query column
called YearProd, which uses the DatePart command to extract the year
from a date range entered by me on a search criteria dialog box. When
I run the query, YearProd correctly displays the year of whatever date
I typed in the dialog box.
Now, I want to add the values of all products made for the year of a
date that was entered in the search criteria dialog box.
This is what I originally entered as the criteria for fldDate:
Between 1/1/YearProd And Now()
But after I tab out of the criteria field, it translates it into the
following (because 2005 happened to be the current value of YearProd):
Between #1/1/05#/"YearProd" And Now()
Then when I run the query, I get an error message that says my query is
either typed incorrectly or too complex.
Am I using the wrong syntax, or can this even be done? Does anyone
know how to create an expression for a date field in a query that
references the year that is stored in another column of that same
query?
Thanks,
Jessi