how can I update a field based on another field

M

Marly

Hello,

I don't know if this is possible. I use a form to populate my Reform table.
I have a field called "Type of Reform" which can only be "Major" or "Minor"
or "Future".
THere is another field called "DB-Year" with the default as 2009.
What I would like to know if this is possible is to have the number 2010 in
the "Db_year" each time I enter the word "Future" in the "Type of Reform"
field.
Is that possible? if yes, please how to do this.
THanks
Marie
 
J

Jeff Boyce

Marly

Are you looking forward to remembering to modify this every year? While it
would certainly be possible to set a default value in a form (or on a
field), setting it to a specific value means you'll need to remember to
change it.

Assuming you might want to use the database for more than one year, what
about the idea of setting the default value to "one more than the current
year". Currently, in 2008, that would calculate to "2009". Then next year
(starting 1/1/2009), it would default to "2010", and so on...

You could use something like (untested):

NewValue = Year(Date()) + 1

You can add code to the AfterUpdate event of the control to test to see if
your "future" choice was picked, and if so, to set the value of the control
for the year there.

Good luck!

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
M

Marly

Thanks Jeff,

I will try that and see if it works. Yes I have been using this database
for 2 years now, and each time I have to check if there are no mistakes when
I enter "future" to have the year+1. ANd this is cause for mistakes. So
will try and let you know if I was able to do it and it it works.
Any other way, I might go with this?
Thanks
 
J

Jeff Boyce

Marly

I'd suggest trying the suggestion first. If it works and has acceptable
performance, I tend to move on...

Regards

Jeff Boyce
Microsoft Office/Access MVP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top