Results 1 to 2 of 2
  1. #1
    New Lounger
    Join Date
    Feb 2004
    Thanked 0 Times in 0 Posts

    Executing Form Code From Another Form (1)

    How do you have VBA code for one form execute a subroutine in another form. Example:

    Code in Form A opens Form B.
    A value is entered or selected in form B.
    Code in Form B puts the selected or entered value into a control in Form A.
    How do I now have code in Form B to excute the Afterupdate subroutine for the updated control in Form A?

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Thanked 31 Times in 31 Posts

    Re: Executing Form Code From Another Form (1)

    Event procedures are created as Private subs by default. If you want to call an event procedure from another form, you must make it Public:<pre>Public Sub ControlName_AfterUpdate()
    End Sub</pre>

    You can then call it as follows from another form:<pre>Forms!FormA.ControlName_AfterUpdate</pre>


    Of course, you must replace FormA and ControlName by the appropriate names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts