help! the value change

  • Thread starter Thread starter qye2020
  • Start date Start date
Q

qye2020

I have one cost field on a simple form, every time user update this cost
field, i need to insert or update the change of cost into a column in the
same table. For example, cost before update is $100, user changes it to
$120, then $20 should be insert into cost_change column. Next time if user
chnage it to $130, then $10 will be persisted.

How to do it in the Access form? Thanks in advance.
 
Put the following code in the OnEnter event of the cost textbox:
Dim OldCost As Currency
OldCost = NZ([Cost],0)

Put this code in the AfterUpdate event of the cost textbox:
Me!Cost_Change = Me!Cost - OldCost
 
Thanks a lot.

PC Datasheet said:
Put the following code in the OnEnter event of the cost textbox:
Dim OldCost As Currency
OldCost = NZ([Cost],0)

Put this code in the AfterUpdate event of the cost textbox:
Me!Cost_Change = Me!Cost - OldCost


--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
(e-mail address removed)
www.pcdatasheet.com


qye2020 said:
I have one cost field on a simple form, every time user update this cost
field, i need to insert or update the change of cost into a column in the
same table. For example, cost before update is $100, user changes it to
$120, then $20 should be insert into cost_change column. Next time if user
chnage it to $130, then $10 will be persisted.

How to do it in the Access form? Thanks in advance.
 
Back
Top