A Microsoft Office (Excel, Word) forum. OfficeFrustration

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.

Go Back   Home » OfficeFrustration forum » Microsoft Access » New Users
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Table data update



 
 
Thread Tools Display Modes
  #1  
Old January 27th, 2010, 09:36 PM posted to microsoft.public.access.gettingstarted
HubbyMax
external usenet poster
 
Posts: 35
Default 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
  #4  
Old January 28th, 2010, 08:47 PM posted to microsoft.public.access.gettingstarted
Steve[_77_]
external usenet poster
 
Posts: 1,017
Default 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  
Old January 28th, 2010, 09:13 PM posted to microsoft.public.access.gettingstarted
John Spencer
external usenet poster
 
Posts: 7,815
Default 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  
Old January 29th, 2010, 12:16 AM posted to microsoft.public.access.gettingstarted
HubbyMax
external usenet poster
 
Posts: 35
Default 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

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 11:24 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.