Reference Event on Other Form

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Bruce B

    #1

    Reference Event on Other Form



    I have two forms, Form1 and Form2.

    Form1 has a command button, cmd1 with a click event: cmd1_Click()

    I'd like to be able to also run this click event from a command button
    on Form2.

    How do I this?

    I tried (in form2):

    Form_Form1.cmd1 _Click()

    and several other possibilities, but none of them work.

    Thanks for the help.

    - Bruce

    *** Sent via Developersdex http://www.developersdex.com ***
    Don't just participate in USENET...get rewarded for it!
  • Deano

    #2
    Re: Reference Event on Other Form

    Bruce B wrote:[color=blue]
    > I have two forms, Form1 and Form2.
    >
    > Form1 has a command button, cmd1 with a click event: cmd1_Click()
    >
    > I'd like to be able to also run this click event from a command button
    > on Form2.
    >
    > How do I this?
    >
    > I tried (in form2):
    >
    > Form_Form1.cmd1 _Click()
    >
    > and several other possibilities, but none of them work.
    >
    > Thanks for the help.
    >
    > - Bruce
    >
    > *** Sent via Developersdex http://www.developersdex.com ***
    > Don't just participate in USENET...get rewarded for it![/color]

    I use this code to make the Afterupdate event fire in another control;

    Forms!frm_main. April_AfterUpda te

    and the event is named as follows;

    Sub April_AfterUpda te()
    'my code
    End sub

    Just amend for a click event and it should work.

    hth
    Martin


    Comment

    • Terry Kreft

      #3
      Re: Reference Event on Other Form


      The easiest way to do this is to change the declaration of the Click event
      from Private to Public.


      Terry

      "HJ" <hjnospam@hotma il.com> wrote in message
      news:3f57581a$0 $132$e4fe514c@d reader4.news.xs 4all.nl...[color=blue]
      > Hmm, you better write a procedure in a module and have both the command
      > button and the second form call that procedure. What are you trying to
      > accomplish?
      >
      > HJ
      >
      > "Bruce B" <bruce@mtigloba l.com> wrote in message
      > news:3f57416f$0 $62076$75868355 @news.frii.net. ..[color=green]
      > >
      > >
      > > I have two forms, Form1 and Form2.
      > >
      > > Form1 has a command button, cmd1 with a click event: cmd1_Click()
      > >
      > > I'd like to be able to also run this click event from a command button
      > > on Form2.
      > >
      > > How do I this?
      > >
      > > I tried (in form2):
      > >
      > > Form_Form1.cmd1 _Click()
      > >
      > > and several other possibilities, but none of them work.
      > >
      > > Thanks for the help.
      > >
      > > - Bruce
      > >
      > > *** Sent via Developersdex http://www.developersdex.com ***
      > > Don't just participate in USENET...get rewarded for it![/color]
      >
      >[/color]


      Comment

      Working...