Saving a calculation to a database

  • Thread starter Bakr Z via AccessMonster.com
  • Start date
B

Bakr Z via AccessMonster.com

Hi to all...
I am facing a problem that is I have a form that includes text fields from a
specified table in my database...
My form is having text fields that displaying the record of the table. I have
to field (unit price and quantity) I want to make calculation of these two
fields (unit price * quantity) and the result must be saved in a field of the
database (total price)...the problem is I am trying to display the reult in a
text field(until now it is working) but I can't pass the value to be saved in
the corresponding field in my database.....
Help will be very usefull to me...
Warm Regards
 
T

tina

saving a calculated value to a table violates data normalization guidelines,
and is rarely necessary when the raw values needed for the calculation are
already saved in table fields (the same, or different, tables - doesn't
matter).

but if you have a sound business reason for doing so, then bind the textbox
control in your form to the appropriate field in the underlying table. use a
SetValue action in either a macro or VBA to set the value of the control to
the calculated value, as

Me!MyControlName = (Me!unit price * Me!quantity)

if you're not familiar with the SetValue action in a macro, look up the
topic in Access Help for instructions on the correct syntax.

hth
 

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