Re: Options Group, AfterUpdate Event, OldValue Property and Contro
- From: Ted <Ted@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Tue, 18 Apr 2006 08:24:01 -0700
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)
- Follow-Ups:
- Re: Options Group, AfterUpdate Event, OldValue Property and Contro
- From: Dirk Goldgar
- Re: Options Group, AfterUpdate Event, OldValue Property and Contro
- References:
- Prev by Date: Re: Adding days to a date field
- Next by Date: Re: Stored Procedure from Access
- Previous by thread: Re: Options Group, AfterUpdate Event, OldValue Property and Contro
- Next by thread: Re: Options Group, AfterUpdate Event, OldValue Property and Contro
- Index(es):
Relevant Pages
|