Resetting Default Value

antomack

Registered User.
Local time
Today, 01:34
Joined
Jan 31, 2002
Messages
215
Just wondering if the following is possible and if so how to do it.

I have a form that has multiple fields that have default values. These values will be fixed for a quarter and then will change. Currently the users contact me to change the defaults every quarter in the design view of the form so the new defaults show for the quarter.

I'd like to write code that if the user changes the value in these fields to something other than the default value that the default value for the fields will now be the new value. Thus when the user opens the form the next time the defaults will be correct until the start of the next quarter.

Essentially something like below is what I want to do, but the following will not actually update the default values, they return to the previous defaults when you open the form the next time.

if me!Field1 <> me!Field1.defaultvalue then
me!Field1.defaultvalue = me!Field1
end if

I know that I could do this by using a table to store the values which I then read in to the fields as the defaults when the form opens, changes to the values will update the table and thus the next time the values will be the new ones; but I'd prefer to have a solution that does not require a table storing the latest values.
 
i understand what you are talking about. i have a database that changes the default value while the form is open, but the value will change back when you go back to the form. i wonder, try running a save function to save the form right after switching the default value. maybe this will keep the new default value. Just a guess...
 
The defaults are production targets that change each quarter, there is no formula involved in their calculation, the management determine them for each quarter. Below is an example of the sort of figures involved for 2001 and 2002.

Eg
SPL Target
Qtr1/2001 4550
Qtr2/2001 4900
Qtr3/2001 4500
Qtr4/2001 5250
Qtr1/2002 6000
Qtr2/2002 7000
Qtr3/2002 6000
Qtr4/2002 7000

The users run the system every two weeks so I'm trying to save on the amount of details they need to enter on the form by defaulting these 3 to whatever the user changed it to in the previous run. Overall the user needs to enter 15 figures, 10 of which change for each run, the other 5 are fixed for each quarter and the users want to have to only enter these 5 once every quarter.

I have tried to do a Save after the defaults are set but this does not save the changed defaults.
 
Thanks for the reply Pat.

It's not so much that I don't want to use a table, more I was trying to find out if you could programatically change the default values. If the actual default values could be reset when the user changes the values in the fields then there would be no maintenance required as the defaults reset to the new values.

Since I knew about the option of using a table to save the latest values I just wanted to try and get other possible solutions by pointing out that I knew about the table solution.
 

Users who are viewing this thread

Back
Top Bottom