Full Version: Clear Variable to View Previous Records -- Prevent Overwrite
UtterAccess Forums > Microsoft® Access > Access Forms
In completing a form, I have grabbed the field "ENTEREDBY" from the previous form by:
Private Sub Form_Current()
holdvalue = Me.ENTEREDBY
End Sub
Private Sub Form_AfterUpdate()
holdvalue = Nz(Me.ENTEREDBY, "")
End Sub
This is so that the person entering the form will not have to re-key in her name each time a new record is added.
However, if I go back to the previous record(s), to perhaps change something or to review, the "ENTEREDBY" field is overwritten with what is in the 'holdvalue' variable. Where can I reset this value so it does not overwrite the field in records when I go back?
Jack Cowley
In the On Current event:
If Me.NewRecord Then
holdvalue = Me.ENTEREDBY
End if
This may be a simplier way to do what you want.
irst of all have a look at this code.
Copy and paste this in a new Module.
on your form's afterupdate event place
enteredby = fosUserName.
You could also use fosUserName as the default value on that field.
Hope this helps.
Jack Cowley
Des -
You are 7 minutes late to the party.... Oh, I know why! 'Tis Saturday in the land of Oz!!!
Otrust all is well, the car is still dent-free and that winter is coming in quietly...
Hello Jack
eat me to it again.
Ofeel like writing a rhyme.
Jack be quick is as far as I can get.
Winter is well and truely here. We are only reaching Maximum temperatures of 25 c.
Jack Cowley
How about -
Back be nimble,
Jack be quick,
Jack beat Des,
Now isn't that a kick in the head!
Well, not that good, but I am no Dr. Seuss...
Jack Cowley
LMAO!!! ONLY 25C! Look for icicles dangling from your roof after then next thunderstorm...
This is our forecast.
Not bad for winter.
Sunday Mostly fine Min 14 Max 26
Monday Shower or two Min 15 Max 24
Tuesday Shower or two Min 14 Max 24
Wednesday Shower or two Min 14 Max 24
Thursday Shower or two Min 14 Max 25
Friday Mostly fine Min 14 Max 27
Jack Cowley
Send me money as I want to move to Australia...at least while it is summer here...
Thank-you both so much for your help! Don't know why I keep hammering away when it was resolved in 1 minute!!!!!! Should have asked sooner!
Glad you got it sorted.
This is a "lo-fi" version of UA. To view the full version with more information, formatting and images, please click here.