help! the value change

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.
 
P

PC Datasheet

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
 
Q

qye2020

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.
 

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