Where Command

BillBee

Registered User.
Local time
Today, 00:43
Joined
Aug 31, 2008
Messages
137
At present I use a query to sort the years (eg > 2005 in the criteria of the year field to give me the previous 3 years)from which I want to print labels to post a document. I am wondering if there is some code using the Where statement that could be added to the code for printing the labels. The code would need to be able to automatically always read for the previous 3 years. Thanks for any help.
 
yup, plenty of examples in this forum - just use the search tool.
 
My searches do not bring up anything other than my thread and the reply. Can you be more precise in where to look. Thanks
 
A little more info would be helpful, e.g. What will the labels say? January 2009, February 2009, etc. or what.

Bob
 
hey! where'd my post go?? did i forget to press "submit"?.... i had a whole list of threads for the OP to peruse...

humph...!
 
raskew. The dates are not used on the labels. They are simply addresses. I am working on an application for a Bird Show. I Have a field in the table which includes names and addresses and one stating the year. I use this field to sort out people who have exhibited in the previous 3 years to send out a document called a schedule. As I said earlier I use >2005 in a query to provide what I want but I would like to have something in the code to print the labels that includes a Where statement that would always be giving me the exhibitors from the previous 3 years.
 
Hi -

In the criteria cell of your date field, place:

>= dateadd("yyyy", -3, date())

Bob
 
Raskew My apologies. When I set this field up I originally had the Data Type as Date. As the formatting (I believe) would not allow just the Year I changed the type to Number as it was only necessary for me to use the year to get from the Table when someone Exhibited. I would still like the code for the criteria that would perform the same action using the data type as Number. Once again sorry
 
Try:

x = year(date())-4
? x
2005
...so, in the criteria cell of your number field:
> year(date())-4

HTH - Bob
 
or as a one off simply just put >=2005 (or even >2004) in the criteria row

its just that bobs code has built in functionality for all years.
 
Thanks to both of you. I was using >2005 gemma but did not want to have to manually change criteria each year. Code working Bob just needed to use -3 instead of -4.
 

Users who are viewing this thread

Back
Top Bottom