Execute AfterUpdate from VBA

  • Thread starter Thread starter Gerald
  • Start date Start date
G

Gerald

I am assigning a value to a combo box using VBA and I need
for the AfterUpdate event to execute after the value is
assigned to the combo box.

How is this done?

Thank you in advance, for your help.
 
Gerald said:
I am assigning a value to a combo box using VBA and I need
for the AfterUpdate event to execute after the value is
assigned to the combo box.

How is this done?

Thank you in advance, for your help.

You can't trigger the actual event, but you can just call the event
procedure directly; e.g.,

Me!MyCombo = "Foo"
Call MyCombo_AfterUpdate
 
-----Original Message-----


You can't trigger the actual event, but you can just call the event
procedure directly; e.g.,

Me!MyCombo = "Foo"
Call MyCombo_AfterUpdate

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

(please reply to the newsgroup)


How do I call a procedure that is located in a "Microsoft
Access Class Objects" Form, from a module outside of the
Class Objects vba area?

I tried "Public" preceding the "Sub" but this did not work.
 
Gerald said:
How do I call a procedure that is located in a "Microsoft
Access Class Objects" Form, from a module outside of the
Class Objects vba area?

I tried "Public" preceding the "Sub" but this did not work.

So you have the form open, and from code outside the form's module
you're setting the value of a combo box on the form, and then you want
to call the combo box's AfterUpdate procedure? You need to do two
things: first, make the AfterUpdate event procedure a Public Sub, not
Private; and second, qualify the call to the procedure with a reference
to the form. For example:

With Forms!MyForm
!MyCombo = "Foo"
Call .MyCombo_AfterUpdate
End With

That's the equivalent of

Forms!MyForm!MyCombo = "Foo"
Call Forms!MyForm.MyCombo_AfterUpdate

but it only has to resolve the Forms reference once.
 
It works!!!!!!!!! Thank you very much!!!!!!!
-----Original Message-----
work.

So you have the form open, and from code outside the form's module
you're setting the value of a combo box on the form, and then you want
to call the combo box's AfterUpdate procedure? You need to do two
things: first, make the AfterUpdate event procedure a Public Sub, not
Private; and second, qualify the call to the procedure with a reference
to the form. For example:

With Forms!MyForm
!MyCombo = "Foo"
Call .MyCombo_AfterUpdate
End With

That's the equivalent of

Forms!MyForm!MyCombo = "Foo"
Call Forms!MyForm.MyCombo_AfterUpdate

but it only has to resolve the Forms reference once.

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

(please reply to the newsgroup)


.
 
Back
Top