Taking Value From Formula Used In 'Form' To 'Record'

4

4Ankit

Hello there i have designed a form and have included many fields such
as products, qauntity, retail price, price(which is quantity*retail
price). The problem i am getting is that i have wrote a formula in the
price field which calculates quanitty*retail price with the coding
below:

=[Quantity]*[RetailPrice]

i have written this code into the price field control source. When i
run the form the calculation works but does not save the value in my
record. I was wondering why this formula doesnt save the value
formulated from the form into the record i inserted the price field
from. How do i get this value formulated in my form to save into my
'price field name' in the invoice record.

The name of the field is 'price' and teh control source is the code
written above.

All and any help would be great :)
 
A

Arvin Meyer [MVP]

If you are saving the quantity and the price as part of each row of data,
you do not usually need to save the results of a calculation, since it can
be recalculated. Under a few circumstances, such as not saving each of the
elements of the calculation, or processing speed due to millions of
calculations, you may need to save it. If that's the case, push the
calculation from each element (rather than pulling it) like:

Sub Quantity_AfterUpdate()
If Len(Me.Quantity+Me.RetailPrice}>0 Then
Me.Price = Me.[Quantity] * Me.[RetailPrice]
End If
End Sub
--
Arvin Meyer, MCP, MVP
Microsoft Access
Free Access downloads
http://www.datastrat.com
http://www.mvps.org/access
 
4

4Ankit

thanks for the help dude!!!!! Much appreciated :) the sky is all so
clear now:) have a nice day
 

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