Control "on update" not updating

  • Thread starter Thread starter Darhl Thomason
  • Start date Start date
D

Darhl Thomason

I use Allen Browne's Popup Calendar to fill in the date controls on my form.
But when I use the date picker, it does not fire the "on update" code. If I
manually put something in the control, it does fire the "on update" code.

Any ideas?

Thanks!

Darhl
 
The Before_Update and After_Update events of a control are not updated when
you change the value of the control programmatically. That's by design, you
can't change it.

What you can do is to place the code in your Before_Update or After_Update
into a procedure that can be called *either* from the event procedure or
from the code that programmatically changes the value. For example ...

Option Compare Database
Option Explicit

Private Sub CommonProc()
'do something here
End Sub

Private Sub SomeControl_BeforeUpdate(Cancel As Integer)
CommonProc
End Sub

Private Sub SomeButton_Click()
SomeControl = SomeValue
CommonProc
End Sub

In this example 'CommonProc' is declared using the 'Private' keyword in the
form module because it is shared only by code in the same form module. If
you want the procedure to be callable by code in multiple modules, declare
the procedure using the 'Public' keyword in a standard module (not a form,
report, or class module).
 
Back
Top