Table data update

H

HubbyMax

I have a table that contains several fields but I am only concerned with two,
OldPrice and NewPrice. On my form for entering new data both of these fields
show. The custermer is charged using the average of these two fields. My
problem is that when I enter a new NewPrice I need to have the OldPrice field
update to the NewPrice before the change.

EXAMPLE

OldPrice $8.00 NewPrice $10.00

Price goes up to $12.00 and I enter it into the form

Table should update to show

OldPrice $10.00 NewPrice $12.00
 
S

Steve

Try putting the following code in the AfterUpdate event of NewPrice:

Me!OldPrice = Me!NewPrice.OldValue

Steve
(e-mail address removed)
 
H

HubbyMax

I tried your suggestion but get an error stating "Can't find macro
'Me!OldPrice = Me!NewPrice'
 
J

John Spencer

In other words, in design view
== Click on the control
== Select the Event tab of the properties
== Enter [Event Procedure] or select it from the dropdown for After Update
property
== Click on the button at the end of the property box with three dots in it
== Enter the suggested code between the lines
Private Sub xxxxxxxx_AfterUpdate()
Me!OldPrice = Me!NewPrice
End Sub
== Don't forget to use your control names.



John Spencer
Access MVP 2002-2005, 2007-2010
The Hilltop Institute
University of Maryland Baltimore County
 
H

HubbyMax

Thank you both. It works perfectly.

John Spencer said:
In other words, in design view
== Click on the control
== Select the Event tab of the properties
== Enter [Event Procedure] or select it from the dropdown for After Update
property
== Click on the button at the end of the property box with three dots in it
== Enter the suggested code between the lines
Private Sub xxxxxxxx_AfterUpdate()
Me!OldPrice = Me!NewPrice
End Sub
== Don't forget to use your control names.



John Spencer
Access MVP 2002-2005, 2007-2010
The Hilltop Institute
University of Maryland Baltimore County
You need to put the code in the AfterUpdate event of the NewPrice field.

Steve
.
 

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