Need help to multiply 2 text boxes

aaronmarsh632

New member
Local time
Today, 21:02
Joined
Oct 15, 2009
Messages
5
Hi everyone,

Got a question about multiplying.

if i have a table with the following fields..

price 1
quantity1
total1

and i have made a form for this, how can i make the total1 box multiply the other 2 together?

i tried putting [price1]*[quantity1] as the default value but maby im missing somethin' cos this didnt work.

thanks
 
I got a feeling that you have some normalization issues....might want to look into correcting that. Also, storing totals is not normally done. You can generate the value you are looking for in a query.

In the query, create a new field and put the mathmatically formula you want in. Like this:

MyTotal: [price1]*[quantity1]
 
You should have the total as a result from the query not in the table.

base whatever form you have on the query and create another field in the query called total using your formula. (it looked right). That way it will auto change everytime you change the price or quantity.

LWC
 
Dang it scooterbug....you beat by a millisecond! :D

I guess my fingers are fast enough...hehehe
 
This worked gr8 thanks.
just 1 more question. how would i display the result back on the form again?

tnx
 
just a text box and have the control source be that field in the query.
 
tnx, i tried this but couldnt get it 2 work, think i got the code wrong. does any1 know what i hav 2 put

tnx
 
Is your form based on the query? Go to the properties of the form, check your record source. It should be that query correct?

Then on design form you can hit the button that shows you the fields and drag that field over.


LWC
 
oh ryt, it was set to the table so just changed it to the query and seems to be fine.

is it possible to be able 2 use fields from more than 1 source, like a query and a table?

tnx
 
I believe you would need to create a query with all fields you want in it and use that as your record source.
 
Thanks, I thought of this but my query would only let me have a certain amount of fields in it. Any ideas??

tnx
 
Then you would need to have like the main form and some sub forms which would be linked to the main form.

What fields are you wanting?

Could you list your tables and PK? or even better a sample DB?
 
Thanks, I thought of this but my query would only let me have a certain amount of fields in it.
A query has 255 fields allowed in it, but if you use even half of that, something is potentially not designed properly.
 
I'm guessing that the OP has a table where he has fields like:

quantity1
Cost1
quantity2
cost2
quantity3
cost3
etc, etc

Which is obviously a violation of Normalization. Just my 2 cents worth.
 

Users who are viewing this thread

Back
Top Bottom