Programmatically fire events

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,

I have created a user input form with a calendar features.

Essentially, the user can choose to enter the date themselves or click on a
button which opens up the calendar form. After selecting the date, the
calendar form closes and the date input box is populated with the selected
value.

I would like to add a BeforeUpdate event to capture the changes. The
problem is that if the field is set programmatically, the event does not fire.

i.e. if the user inputs a date, the event fires and everything is ok. If
the user uses the calendar to select a date, the date is entered into the
input box via program and hence the trigger does not fire.

So far I have walked around this by removing Private from the form events
and calling in before I call the calendar function.

Is there a "cleaner" way of doing this? i.e. triggering a event tied to a
box using a method.

JB
 
Hi,
you can create a public method in your input form, where you call
BeforeUpdate, and call this method from your calendar form, when date is
selected
 
The forms are objects, and you can run their public methods:

obj.method

The controls are properties, but those properties don't
have 'let' methods. You may be able to attach a 'let'
method to an existing control, but I've never seen it.

Instead, declare a new property and method:

Public Property Let vIDXRecord(vIDX)
dim cancel as integer
4020 Me.edtIDX = vIDX
4000 edtIDX_BeforeUpdate cancel
4030 edtIDX_AfterUpdate
End Property

(air code)

Instead of writing to edtIDX, write to vIDXRecord.

(david)
 
Back
Top