Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

change field from current to previous

Status
Not open for further replies.

taylornow

Technical User
Oct 16, 2000
90
US
Hello everybody - here goes...
Survey Form has these fields - Previous Rating
Current Rating
What I need to happen is when the Current Rating is entered in, the Previous Rating changes to what the Current Rating was. Does that make sense because it sure reads funny? I am just trying to make it automatic so they don't have to key in information that is already there.

Thanks in advance
Taylor

 
Taylor,

Are you saving the values in a table? Do you just want to show the last value entered in the "Previous Rating" and then have a blank field to enter the next rating? _________
Rott Paws

...It's not a bug. It's an undocumented feature.
 
The question is confusing. Okay - When a department gets inspected, the rating has to be entered in the Current Rating field. Which in turn makes the Previous Rating field be the rating that was in the Current Rating Field before the new rating was entered. Golly Pete, reading that makes me dizzy. Anyway. Is there a way to transfer what WAS in the Current Rating Field to the Previous Rating field?

Okay - whew....

Thanks
Taylor
 
OK. Try this . . . .

I think you need to use the CurrentRating_BeforeUpdate event.

Private Sub CurrentRating_BeforeUpdate ()
PreviousRating = CurrentRating.OldValue
End Sub _________
Rott Paws

...It's not a bug. It's an undocumented feature.
 
RottPaws...

You're a genius! I knew it had to do with the BeforeUpdate property, but I was trying to assign the value to a variable and then using that variable in the AfterUpate property. Your solution is a clean, one-step process.

I bow to you!

Jim "Get it right the first time, that's the main thing..." [wavey]
 
Genius??? You are obviously not my wife <grin _________
Rott Paws

...It's not a bug. It's an undocumented feature.
 
Rott Paws
Tried but not working. Syntax error. I tried it with the spaces in the words and without. Either comes up with that error or saying parameters don't match. Variables error. I put it in the Current Rating before update line. What am I doing or not doing?? I don't understand code enough to know all the differences in the error messages.

Thanks in advance
Taylor
 
In design view of your form, right-click on one of the controls and open the properties window and go to the &quot;Other&quot; tab.

Click on the Current Rating field. What is in the name field of the properties window? Get the exact name as it appears in this field.

Next select the previous rating field and get it's name exactly as it appears.

In general practice, it's not a good idea to have spaces, slashes, or other special characters in an object's name.

In my example above, I assumed the current rating field was called &quot;CurrentRating&quot;. If it is named &quot;Current Rating&quot;, you will need to enclose it in brackets like:

[Previous Rating] = [Current Rating].OldValue

If this doesn't work, post the error message you are getting and I'll see if I can figure it out. _________
Rott Paws

...It's not a bug. It's an undocumented feature.
 
Yippeeeee yooooooo - it works. Brackets - amazing what punctuation will do. Is it possible to make it change immediately instead of waiting until you go to the next record?

You are the bestest !

Thanks
Taylor
 
It should make the change as soon as you hit enter or tab in the Current Rating field.

Of course, if that is that last field in the tab order of the form, or if there is a default command button that goes to the next record . . . . _________
Rott Paws

...It's not a bug. It's an undocumented feature.
 
It doesn't change until you go to the next record. I can go back a record and then go back and it is changed. But not while I am still on the original record. It isn't the last field on the form though.
 
Try adding [Previous Rating].requery to the procedure.
_________
Rott Paws

...It's not a bug. It's an undocumented feature.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top