From: PeterM on
I have a form in AC2003. On that form there is a text control for a person's
weight. I have two small buttons just to the right of the text control. One
is an up button and the other is a down button. For the up button:

Private Sub cmdUpCbo_Click()
Me.GM_Weight = Me.GM_Weight + 1
End Sub

and for the down button:

Private Sub cmdDownCbo_Click()
Me.GM_Weight = Me.GM_Weight - 1
End Sub

The following is the code for the dirty event:

Private Sub Form_Dirty(Cancel As Integer)
Me.btnUndo.Enabled = True
Me.btnNew.Enabled = False
Me.btnSave.Enabled = True
Me.btnDelete.Enabled = False
TurnNavigationButtonsOff
End Sub

The problem is that if I go to the weight control and change the value
directly, the onDirty event fires, however, if I touch either the up or down
button, the value in the weight control does what I expect but the onDirty
event does not fire.

To debug this I set the RecordSelectors to Yes and ran the exact same test
with the same exact code. The record selector changes to the pencil if I
change the weight control directly or if I use the up or down buttons.

Why doesn't the onDirty event fire when I use the buttons?

Thanks for your help!


From: John W. Vinson on
On Sat, 13 Mar 2010 18:50:01 -0800, PeterM <PeterM(a)discussions.microsoft.com>
wrote:

>Why doesn't the onDirty event fire when I use the buttons?
>

By design. It only fires if the value changes because the user types or
selects something in a control.

Try explicitly setting Me.Dirty = True in your click event code.
--

John W. Vinson [MVP]
From: PeterM on
Understood...thank John.

"John W. Vinson" wrote:

> On Sat, 13 Mar 2010 18:50:01 -0800, PeterM <PeterM(a)discussions.microsoft.com>
> wrote:
>
> >Why doesn't the onDirty event fire when I use the buttons?
> >
>
> By design. It only fires if the value changes because the user types or
> selects something in a control.
>
> Try explicitly setting Me.Dirty = True in your click event code.
> --
>
> John W. Vinson [MVP]
> .
>
From: David W. Fenton on
John W. Vinson <jvinson(a)STOP_SPAM.WysardOfInfo.com> wrote in
news:r2lop51f98hlnjnpjhd35bovvcjnc0r7mk(a)4ax.com:

> Try explicitly setting Me.Dirty = True in your click event code.

Well, you learn something every day.

I wonder what doing that does to a record's generation number in a
replicated database...

--
David W. Fenton http://www.dfenton.com/
usenet at dfenton dot com http://www.dfenton.com/DFA/
From: a a r o n . k e m p f on
I'd assume it would crash and burn any jet database, voiding the
transaction, and requiring re-entry of data





On Mar 14, 1:58 pm, "David W. Fenton" <XXXuse...(a)dfenton.com.invalid>
wrote:
> John W. Vinson <jvinson(a)STOP_SPAM.WysardOfInfo.com> wrote innews:r2lop51f98hlnjnpjhd35bovvcjnc0r7mk(a)4ax.com:
>
> > Try explicitly setting Me.Dirty = True in your click event code.
>
> Well, you learn something every day.
>
> I wonder what doing that does to a record's generation number in a
> replicated database...
>
> --
> David W. Fenton                  http://www.dfenton.com/
> usenet at dfenton dot com    http://www.dfenton.com/DFA/