T
trekgoes2malaysia
I am trying to figure out how I can reset a value from a list box on
a form to its original value if the new selection a user chooses
violates a condition in my code (in this case a MsgBox would appear
asking the user to go back and select a different item). My problem
is that when VBA returns the user back to the screen page, the
selection has been changed to the last entry the user chose and not
the original.
The code is in an "On Change" event procedure. I tried capturing the
original value using a separate event procedure "Before_Update" which
I call in the "On Change" one but it would only return a 0 value since
it is likely not reading the variable from the before_update procedure
properly.
' Checking to make sure no lap times exist if user is trying to
reduce the effor tdistance
For i = 2 To j
If z(i) > getdistance And (IsNull(Me("t" & i)) = False )
Then
MsgBox ("Before changing effort distance, you must
delete lap times for distances greater than " & getdistance & "m")
Me![Effort Distance:] = Me![Effort Distance:].Undo
Exit Sub
End If
Next
Any suggestions on how to resolve this?
Thanks
Patrick
a form to its original value if the new selection a user chooses
violates a condition in my code (in this case a MsgBox would appear
asking the user to go back and select a different item). My problem
is that when VBA returns the user back to the screen page, the
selection has been changed to the last entry the user chose and not
the original.
The code is in an "On Change" event procedure. I tried capturing the
original value using a separate event procedure "Before_Update" which
I call in the "On Change" one but it would only return a 0 value since
it is likely not reading the variable from the before_update procedure
properly.
' Checking to make sure no lap times exist if user is trying to
reduce the effor tdistance
For i = 2 To j
If z(i) > getdistance And (IsNull(Me("t" & i)) = False )
Then
MsgBox ("Before changing effort distance, you must
delete lap times for distances greater than " & getdistance & "m")
Me![Effort Distance:] = Me![Effort Distance:].Undo
Exit Sub
End If
Next
Any suggestions on how to resolve this?
Thanks
Patrick