Re: Kick Starting AfterUpdate Event in another Form

Tech-Archive recommends: Fix windows errors by optimizing your registry

From: TC (no_at_email.here)
Date: 04/30/04


Date: Fri, 30 Apr 2004 11:04:39 +0930


"Pete Halfacree" <NoSpamPeter.Halfacree@baesystems.com> wrote in message
news:5c2801c42dc7$980f0700$a401280a@phx.gbl...
> TC,
>
> This is the response I was looking for.
>
> I will take your comments "On Board" about using Public
> Modules, although I will have to analyse my Process again.

Hi Pete. Note that I meant "the procedure or function", not "the module",
when I used the word "it" in the second sentence: "If two forms call the
same procedure, it is best to declare that procedure in a module on the
Modules tab. Declare >it< Public ..." That is, declare the procedure or
function Public, not the module. It is not a "public module". It is properly
called a "standard" module (as opposed to a "class" module).

>
> Thank you once more.

No probs, good luck.

TC

>
> Regards,
>
> Pete
> >-----Original Message-----
> >Pete, if you want to call a procedure or function within
> a form module from
> >"outside", you must declare the procedure or function
> Public:
> >
> >form #1's module:
> >
> > PUBLIC sub do_stuff
> > msgbox "in do_stuff!"
> > end sub
> >
> >then from some other form:
> >
> > forms("... the form name ...").do_stuff
> >
> >But generally it is not good practice to do that. If two
> forms call the same
> >procedure, it is best to declare that procedure in a
> module on the Modules
> >table. Declare it Public, as above. Then either form (or
> any other sub or
> >function in any module) can call it just by saying:
> do_stuff.
> >
> >If it needs to know values from the calling form, just
> pass those values as
> >parameters:
> >
> >declaration of do_stuff in a Module:
> >
> > Public do_stuff (Blah as Integer)
> > msgbox "do_stuff! " & Blah
> > end
> >
> >calling do_stuff from within a form module, passing the
> integer value from
> >control txtBlah:
> >
> > do_stuff me![txtBlah]
> >
> >HTH,
> >TC
> >
> >
> >"Pete Halfacree" <anonymous@discussions.microsoft.com>
> wrote in message
> >news:535101c42cf9$182e68b0$a401280a@phx.gbl...
> >> TC, Thank you for your prompt response.
> >>
> >> Calling the Sub your way can only be done within the
> form
> >> having the Event Procedure and this how I have called up
> >> the Event (based on the GotFocus Event of the Control
> >> stimulated by the Enter + Back Tab).
> >>
> >> I have tried to Run the procedure from the Calendar form
> >> using:
> >> Run frm.ActiveControl.Name & "_AfterUpdate [Event
> >> Procedure]".
> >> Access tells me it can't find the procedure.
> >>
> >> I have also tried Run frm.name & "." &
> >> frm.ActiveControl.Name & "_AfterUpdate" and still no
> joy.
> >>
> >> Surely there must be a way!
> >>
> >> Regards, Pete
> >> >-----Original Message-----
> >> >If a control has an event (including but not limited to
> >> AfterUpdate) - say:
> >> >
> >> > private sub ctl_AfterUpdate()
> >> >
> >> >you can invoke that event procedure manually, just like
> >> any other procedure:
> >> >
> >> > msgbox "calling.."
> >> > ctl_AfterUpdate
> >> > msgbox "called!"
> >> >
> >> >From a code structure viewpoint, it may be better to
> put
> >> the common code in
> >> >a seperate procedure:
> >> >
> >> > private sub ctl_AfterUpdate()
> >> > do_stuff
> >> > end stuff
> >> >
> >> > msgbox "calling.."
> >> > do_stuff
> >> > msgbox "called!"
> >> >
> >> > private do_stuff()
> >> > ...
> >> > end sub
> >> >
> >> >Now, if you need to add something extra for the
> >> AfterUpdate case, but not
> >> >for the "called programatically" case, you can do that
> >> easily.
> >> >
> >> >HTH,
> >> >TC
> >>
> >
> >
> >.
> >



Relevant Pages

  • Re: some people "think"...
    ... commentators make their living announcing TODAY's tennis. ... he has something pete didn't - +1 FO, ... I do not think the United States would come to an end if ... we lost our power to declare an Act of Congress void. ...
    (rec.sport.tennis)
  • Re: Kick Starting AfterUpdate Event in another Form
    ... Pete, if you want to call a procedure or function within a form module from ... it is best to declare that procedure in a module on the Modules ... If it needs to know values from the calling form, ... > having the Event Procedure and this how I have called up ...
    (microsoft.public.access.formscoding)
  • Re: Pete Samprass domination - A statistical summary
    ... "However, it would be difficult to argue that Andre is a better player than Pete if you consider that, head-to-head, Pete has a 20-14 edge in career meetings, 4-1 in major finals, 9-7 in finals meetings, regardless of tournament. ... He's saying head-head should be the first basis of comparison between contemporaries, ... I do not think the United States would come to an end if ... we lost our power to declare an Act of Congress void. ...
    (rec.sport.tennis)
  • Re: How to pass multi-dimensional array?
    ... pete wrote: ... I like the pointer notation for the parameter, ... If I declared it the way you suggest, the compiler I use most frequently would insist on reminding me that I should declare 'm' to be const. ...
    (comp.lang.c)
  • Re: struct question
    ... > pete wrote: ... >> I am inclined not to put extern object declarations in a header. ... > publicizing those portions of the .c file you want to make ... > accessible externally you declare them in the .h file, ...
    (comp.lang.c)