How To:? Update One Field Based On Another Field

G

Guest

I'm a new Access user & am trying to figure out how to input a date in one
field, [Maint]![Acquired], & have Access add three (3) years to the date &
update another field, [Maint]![Inital Warranty Expiration].

I found a clue that I can not use functions as a basis for default values of
a record in a table, rather I should "create a SIMPLE(?) piece of code to
update that field on the BeforeUpdate event of the form." Since I'll be
basing my data entry for the table on a form, I think this is the right track
but I have no clue what the"simple piece of code" should look like.
 
D

Douglas J Steele

If the expiration date is always 3 years after the acquired date, it should
not be stored: it should be calculated. Add it as a computed field in a
query (use DateAdd("yyyy", 3, [Acquired])), and use the query wherever you
would otherwise have used the table.
 
G

Guest

Thanx for the reply, but not sure if this will ultimately meet my needs
because when all is said & done, i'll want to have a calculated field in a
query that will check a filed [Extended Warranty Expiration] & if it's not
Null subtract Data() from it to give us the numboer of Warranty days left.
If [Extended Warranty Expiration] is Null, then it will use the [Inital
Warranty Expiration] field.

If there is another way to do this, please point me in the right direction.

Thanx in advance for all the help.

John

Douglas J Steele said:
If the expiration date is always 3 years after the acquired date, it should
not be stored: it should be calculated. Add it as a computed field in a
query (use DateAdd("yyyy", 3, [Acquired])), and use the query wherever you
would otherwise have used the table.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


TheHouse said:
I'm a new Access user & am trying to figure out how to input a date in one
field, [Maint]![Acquired], & have Access add three (3) years to the date &
update another field, [Maint]![Inital Warranty Expiration].

I found a clue that I can not use functions as a basis for default values of
a record in a table, rather I should "create a SIMPLE(?) piece of code to
update that field on the BeforeUpdate event of the form." Since I'll be
basing my data entry for the table on a form, I think this is the right track
but I have no clue what the"simple piece of code" should look like.
 
D

dbahooker

I dont' agree with douglas.

never say 'never' and i always store calculations.

do you know why??? because there is always an exception to the rule.
 
G

Guest

Thanx for the advice, but could you possibly give me a clue as to how to do
the calcultions?
 

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