How do I set a default for the whole year

  • Thread starter Thread starter Jon
  • Start date Start date
J

Jon

I have developed a program that contains a lot of controls that are on forms
and reports along with queries that require a criteria for the year. For
example, a query might have a field with a criteria for Year=2006. When the
new year starts I want the user to be able to select a pulldown on a form
somewhere that is hidden and select the year. This pulldown control would be
the criteria for all my controls and queries throughout the program for that
year. Can anyone offer some advice as to how I would do this. Thank You
 
Because, for a few days or weeks even, at the beginning of the new year ,
the program still needs to work for the previous year, UNTIL they start the
new project for the current year. does this make any sense?
 
Thanks very much for the help Rick,
But I mustn't have been clear in my explanation. Not unheard of...
or am not understanding your suggestion.
I gather yau are suggesting that I put =Format(Date(),"YYYY")
in the criteria for EACH of the form & report controls
along with all the different queries field criteria.
Let me try my explanation again.
The forms & reports have recordsources with a field
"ProductionYear" throughout the program.
Currently these field's criteria is SET to "PRD2005".
The users don't see this field anywhere in the program.
In the past, when they would ask me to set the program for the
next years procject I would go thru each of the forms, reports and
querries to set the criteria in that field to "PRD2006".
I'm looking for a way wherby the Administrator
could set this criteria in ONE place and have all the field criteria
set to that control for the rest of the year.
I was thinking of a small hidden form with a pulldown,
but when the user exits the database and gets back in
that control has to be set again.

I want to be able to "set it & forget it" so to speak.
Instead of me having to go into each form, report, query
at the beginning of each year when they are ready to start the
new project just to set the "ProductionYear".
I hope this explanation make better sense.
 
It looks like you need a global variable called for example
glb_ProductionYear.

Create a function that fetches the value of this global variable, call it
GetProductionYear(). You'll need to modify all your queries. For example, you
might need to add a clause WHERE ProductionYear=GetProductionYear() in all
your queries.

Have your function fetch the value from a hidden form or even from a table.
It's up to you.

Ray



Thanks very much for the help Rick,
But I mustn't have been clear in my explanation. Not unheard of...
or am not understanding your suggestion.
I gather yau are suggesting that I put =Format(Date(),"YYYY")
in the criteria for EACH of the form & report controls
along with all the different queries field criteria.
Let me try my explanation again.
The forms & reports have recordsources with a field
"ProductionYear" throughout the program.
Currently these field's criteria is SET to "PRD2005".
The users don't see this field anywhere in the program.
In the past, when they would ask me to set the program for the
next years procject I would go thru each of the forms, reports and
querries to set the criteria in that field to "PRD2006".
I'm looking for a way wherby the Administrator
could set this criteria in ONE place and have all the field criteria
set to that control for the rest of the year.
I was thinking of a small hidden form with a pulldown,
but when the user exits the database and gets back in
that control has to be set again.

I want to be able to "set it & forget it" so to speak.
Instead of me having to go into each form, report, query
at the beginning of each year when they are ready to start the
new project just to set the "ProductionYear".
I hope this explanation make better sense.
Yes, but I said why not DEFAULT it. They could still type over it.
[quoted text clipped - 14 lines]
 
Back
Top