Inventory Program

H

HubbyMax

Another problem. I have several calculated fields on my Enter Products form.
I would like to have these calculations entered on the Products2 table but
they leave the corrasponding fields blank.

TotalValue = (([NuPrice] + [CuPrice] / 2) * [UnitsInStock]

This fills in the Total Value of Current Stock field on the form but does
transfer the result to the Products2 table.
 
B

BobbyDazzler

HubbyMax,

Basically, it shouldn't! It is generally accepted that you should not
store calculated results. That said, if you really want to, you'll
need to either have an append query to add the result or add them to a
recordset in VBA.

David

Share what you know, learn what you don't
 
D

Daryl S

Only bound fields are stored to tables. You can either add the 'calculated'
fields to the table as hidden fields, and then use a 'BeforeUpdate' event to
set them to be the values of the corresponding unbound fields on the form,
or you can change the unbound fields on the form to be the fields from the
table, and then run code containing the calculations to update these fields
whenever data in the source fields change (e.g. NuPrice, CuPrice, or
UnitsInStock).
 
H

HubbyMax

Thank you. I was able to get this working using your suggestions.

Daryl S said:
Only bound fields are stored to tables. You can either add the 'calculated'
fields to the table as hidden fields, and then use a 'BeforeUpdate' event to
set them to be the values of the corresponding unbound fields on the form,
or you can change the unbound fields on the form to be the fields from the
table, and then run code containing the calculations to update these fields
whenever data in the source fields change (e.g. NuPrice, CuPrice, or
UnitsInStock).


--
Daryl S


HubbyMax said:
Another problem. I have several calculated fields on my Enter Products form.
I would like to have these calculations entered on the Products2 table but
they leave the corrasponding fields blank.

TotalValue = (([NuPrice] + [CuPrice] / 2) * [UnitsInStock]

This fills in the Total Value of Current Stock field on the form but does
transfer the result to the Products2 table.
 

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

Similar Threads

Monthly Inventory Report 18
Update UnitsInStock 9
Access 2007 0
Calculated field in a table 6
update another table afterinsert 9
Inventory Help 3
New Record 4
Inventory Transaction Problem 1

Top