|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Calculated fields
I have a field called price and one called list price. In a Update Query if possible I would like to do the following
1 Take the PRICE FIELD and get 10% of that field which I understand [Products]![Price] * .1 2 Then I would like to take that result and add it to the Product price field. 3 Last I would like to take that total and update the Corresponding [Products]![listPrice] field with that total. Should I do this by writing a Function or can I just code it right into the UPDATE FIELD for LIST PRICE. and if so how. Thanks in advance Jon |
|
#2
|
|||
|
|||
|
Figured it out if anyone is interested
This is the code I used to add 10% to the list price field and update it
Dim PCTVal As Double, Tot As Double Set rstListPrice = CurrentDb.OpenRecordset("Table Name") Do Until rstListPrice.EOF PCTVal = rstListPrice("Price") * 0.1 Tot = rstListPrice("Price") + PCTVal rstListPrice.Edit rstListPrice("listPrice") = Round(Tot, 2) rstListPrice.Update rstListPrice.MoveNext Loop |
![]() |
| Viewing: ASP Free Forums > Database > Microsoft Access Help > Calculated fields |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|