How do I set the default value property of a field as the sum of .

R

Rehan Razak

Hi,

I have three fields say A,B,C in a table Table1....and I need the to set the
default value of the field C as the sum of the other two fields.
A: +[C] ???..(If u think this is right... well think again)
Any help would be greatly appreciated. :)

Rehan Razak
 
D

Douglas J. Steele

You can't, nor should you.

If field A is always the sum of fields B and C, it shouldn't be stored in
the table. Instead, you should create a query that calculates it and use the
query wherever you would otherwise have used the table.

If you simply want A to default to B+C, but have the ability to overwrite
it, you'll have to use a form to do your updates. In the AfterUpdate event
of the textbox mapped to fields B and C, put logic to check whether both
fields have been defined, and update the value of the textbox mapped to
field A.
 

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