Execute AfterUpdate from VBA


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.
 
Ad

Advertisements

D

Dirk Goldgar

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
 
G

Gerald

-----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.
 
D

Dirk Goldgar

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.
 
Ad

Advertisements

G

Gerald

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)


.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top