If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Table data update
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 |
#2
|
|||
|
|||
Table data update
Try putting the following code in the AfterUpdate event of NewPrice:
Me!OldPrice = Me!NewPrice.OldValue Steve "HubbyMax" wrote in message ... 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 |
#3
|
|||
|
|||
Table data update
I tried your suggestion but get an error stating "Can't find macro
'Me!OldPrice = Me!NewPrice' "Steve" wrote: Try putting the following code in the AfterUpdate event of NewPrice: Me!OldPrice = Me!NewPrice.OldValue Steve "HubbyMax" wrote in message ... 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 . |
#4
|
|||
|
|||
Table data update
You need to put the code in the AfterUpdate event of the NewPrice field.
Steve "HubbyMax" wrote in message ... I tried your suggestion but get an error stating "Can't find macro 'Me!OldPrice = Me!NewPrice' "Steve" wrote: Try putting the following code in the AfterUpdate event of NewPrice: Me!OldPrice = Me!NewPrice.OldValue Steve "HubbyMax" wrote in message ... 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 . |
#5
|
|||
|
|||
Table data update
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 Steve wrote: You need to put the code in the AfterUpdate event of the NewPrice field. Steve "HubbyMax" wrote in message ... I tried your suggestion but get an error stating "Can't find macro 'Me!OldPrice = Me!NewPrice' "Steve" wrote: Try putting the following code in the AfterUpdate event of NewPrice: Me!OldPrice = Me!NewPrice.OldValue Steve "HubbyMax" wrote in message ... 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 . |
#6
|
|||
|
|||
Table data update
Thank you both. It works perfectly.
"John Spencer" wrote: 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 Steve wrote: You need to put the code in the AfterUpdate event of the NewPrice field. Steve "HubbyMax" wrote in message ... I tried your suggestion but get an error stating "Can't find macro 'Me!OldPrice = Me!NewPrice' "Steve" wrote: Try putting the following code in the AfterUpdate event of NewPrice: Me!OldPrice = Me!NewPrice.OldValue Steve "HubbyMax" wrote in message ... 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 . . |
Thread Tools | |
Display Modes | |
|
|