Re: Options Group, AfterUpdate Event, OldValue Property and Contro



hi dirk,

i've (hopefully) faithfully implemented your ideas into this and, by golly,
it looks as though they're doing it :-)

thanks once again!!

-ted


"Dirk Goldgar" wrote:

"Ted" <Ted@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:8A18FF84-23F0-4B59-A6BF-4437AAAF3D7A@xxxxxxxxxxxxx
hi dirk,

well i guess that did answer my posting, but what i'm left with is
basically an impossible objective. am i right about this as well?

No, not at all. But you can't do it using the OldValue property;
you'll have to keep track of the control's previous values yourself. As
I understand it, you want to know and take an action every time the
option group's value is updated by the user, regardless of how many
times the user changes the value of the control, whether the user saves
the current record with that value or not. And the action taken each
time depends on what the value was before the user changed it -- each
time -- as well as what the value is now.

If my understanding is correct, what you need to do is declare a
*module-level* variable which will always hold the value of the control
(before it was changed). Set the variable in the form's Current event,
and as the last thing you do in the control's AfterUpdate event. Refer
to this variable instead of the control's OldValue property, when you
want to know what the value "used to be".

Here are the relevant bits of code:

'----- start of example code for form's module -----
Option Compare Database
Option Explicit

Dim mvarOldValue As Variant


Private Sub Form_Current()

mvarOldValue = Me!Frame1

End Sub

Private Sub Frame1_AfterUpdate()

' ... code that refers to Frame1's current value
' and to mvarOldValue ...

Select Case Frame1

' ... whatever ...

End Select

' Now that we've taken whatever action we wanted based
' on the old and new values, update the "old value".

mvarOldValue = Me!Frame1

End Sub
'----- end of example code -----

--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)



.



Relevant Pages

  • Re: Options Group, AfterUpdate Event, OldValue Property and Contro
    ... times the user changes the value of the control, ... Refer ... Dim mvarOldValue As Variant ... Private Sub Frame1_AfterUpdate ...
    (microsoft.public.access.formscoding)
  • Re: Options Group, AfterUpdate Event, OldValue Property and Contro
    ... times the user changes the value of the control, ... Refer ... Dim mvarOldValue As Variant ... Private Sub Frame1_AfterUpdate ...
    (microsoft.public.access.formscoding)
  • Re: Specific cell
    ... Private Sub Worksheet_Change ... To do this, right-click on the sheet tab, select ... > changes the value of a specific cell. ... but I only want to show the message when the user changes the value. ...
    (microsoft.public.excel.programming)
  • Re: Enable on record change
    ... If you also want to disable the combo whenever the user changes the value of ... the Text property only returns a value when that control has the focus. ... "Dan" wrote in message ... > Private Sub Form_Current ...
    (microsoft.public.access.forms)