A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » General Discussion
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

How do I: trigger afterupdate event on a different form



 
 
Thread Tools Display Modes
  #1  
Old October 24th, 2008, 12:51 AM posted to microsoft.public.access
AC[_2_]
external usenet poster
 
Posts: 20
Default How do I: trigger afterupdate event on a different form

Hi

I would like to run some code in a module (or perhaps another form)
which:

1. opens another form
2. populates a combo box with a particular value that I want
3. runs the after update event for that combo box.

I have the following code which does steps 1 and 2 OK:

stFormName = "f_combo"
DoCmd.OpenForm stFormName, , , stLinkCriteria
Forms(stDocName).Controls("Combo3").Value = "Hello"

I need to know how to do step (3)

Out of interest, what triggers an after update event? I naively
expected my code above to trigger it automatically when I updated the
value to "hello".

When you answer, could you also indicate if I need to make my after
update event on Combo3 public, or can it remain "private" and still
work.

Thanks in advance
Andy C
  #2  
Old October 24th, 2008, 04:08 AM posted to microsoft.public.access
Tom van Stiphout[_2_]
external usenet poster
 
Posts: 1,653
Default How do I: trigger afterupdate event on a different form

On Thu, 23 Oct 2008 16:51:24 -0700 (PDT), AC
wrote:

Change that procedure to Public.
Or put most of the code in a Public procedure in a standard module,
and call it from both the AfterUpdate event, and your current code.

-Tom.
Microsoft Access MVP


Hi

I would like to run some code in a module (or perhaps another form)
which:

1. opens another form
2. populates a combo box with a particular value that I want
3. runs the after update event for that combo box.

I have the following code which does steps 1 and 2 OK:

stFormName = "f_combo"
DoCmd.OpenForm stFormName, , , stLinkCriteria
Forms(stDocName).Controls("Combo3").Value = "Hello"

I need to know how to do step (3)

Out of interest, what triggers an after update event? I naively
expected my code above to trigger it automatically when I updated the
value to "hello".

When you answer, could you also indicate if I need to make my after
update event on Combo3 public, or can it remain "private" and still
work.

Thanks in advance
Andy C

  #3  
Old October 24th, 2008, 03:40 PM posted to microsoft.public.access
Klatuu[_3_]
external usenet poster
 
Posts: 396
Default How do I: trigger afterupdate event on a different form

Tom's solution is correct. I would recommend the actual code be in a public
sub or function in a standard module so that it can be called from both the
combo's After Update and from your code.

As to why it does not fire from your code. After Update and some other
events - Before Update, for example, only fire when the control is updated
manually. Changing the value of the control using VBA or a Macro will not
cause the events to fire. This is not a shortcoming, but a advantage. It
gives you more control. You really don't want events firing when you make
changes in code.

"AC" wrote in message
...
Hi

I would like to run some code in a module (or perhaps another form)
which:

1. opens another form
2. populates a combo box with a particular value that I want
3. runs the after update event for that combo box.

I have the following code which does steps 1 and 2 OK:

stFormName = "f_combo"
DoCmd.OpenForm stFormName, , , stLinkCriteria
Forms(stDocName).Controls("Combo3").Value = "Hello"

I need to know how to do step (3)

Out of interest, what triggers an after update event? I naively
expected my code above to trigger it automatically when I updated the
value to "hello".

When you answer, could you also indicate if I need to make my after
update event on Combo3 public, or can it remain "private" and still
work.

Thanks in advance
Andy C



 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 05:36 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.