Results 1 to 8 of 8
  1. #1
    4 Star Lounger
    Join Date
    Jun 2001
    Location
    Indianapolis, Indiana, USA
    Posts
    527
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Calling another routine (AXP)

    Hi,
    I would like to call a routine in another loaded form using VBA. How do you do that, or should I say, is that possible? What I have is a main form and inside that main form is a sub form. In that sub form, I want to run the form load action. If it is possible, I believe it would be a "Call" statement but I am not sure how it would be formatted.

    Thanks,
    Mark

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Calling another routine (AXP)

    You must make the Form_Load event procedure of the subform into a Public subroutine (event procedures are Private by default.)

    Let's say that the name of the subform as a control on the main form is sbfMySubform. You can call its Form_Load event as follows from the main form:

    Me.sbfMySubform.Form.Form_Load

    Me refers to the main form,
    sbfMySubform refers to the subform as a control,
    Form refers to the subform as a form in itself,
    Form_Load is the name of the event procedure.

  3. #3
    4 Star Lounger
    Join Date
    Jun 2001
    Location
    Indianapolis, Indiana, USA
    Posts
    527
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Calling another routine (AXP)

    Thanks,
    Is there someplace in the program where it gives some help about what the possible choices are for these things? I mean, it seems as though since I switched to AXP, the help (F1) file is not as good. Maybe I need to install some other files!

    Thanks,
    Mark

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Calling another routine (AXP)

    "Someplace" is called Woody's Lounge! <img src=/S/grin.gif border=0 alt=grin width=15 height=15>

    But seriously, the HTML help files in Office 2000 and up are much harder to use than the Windows help files. In Access 2002 (which is what I'm using), a lot of the help is there, but there is often no straightforward way to find it. And some things are not documented at all. That's where sites like this, and the Microsoft newsgroups etc. come in. And you can find out a lot by experimenting. As long as you keep backup copies of your databases, you can try out things as much as you like.

  5. #5
    4 Star Lounger
    Join Date
    Jun 2001
    Location
    Indianapolis, Indiana, USA
    Posts
    527
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Calling another routine (AXP)

    That is pretty much what I am doing. I just don't want to make some dumb posts here when there is something a mouse click away. I have been using this board for a couple of years now and I wouldn't have survived doing what I am doing without all of you experts!

    I also used to use the search function on this site but I know why it is not working right now. I will be very happy when they turn it back on!

    Thanks,
    Mark

  6. #6
    4 Star Lounger
    Join Date
    Jun 2001
    Location
    Indianapolis, Indiana, USA
    Posts
    527
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Calling another routine (AXP)

    Thanks Hans,
    This works. How do I call a sub routine on a parent form from inside the subform?

    Subform = part_temp update
    Parent form = wo_update

    Thanks,
    Mark

  7. #7
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Calling another routine (AXP)

    Again, the subroutine must be declared as public. Use

    Me.Parent.Name_of_procedure

    Me refers to the form that executes the code, i.e. the subform.
    Parent refers to the main form.

  8. #8
    4 Star Lounger
    Join Date
    Jun 2001
    Location
    Indianapolis, Indiana, USA
    Posts
    527
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Calling another routine (AXP)

    Thanks Hans,
    I made sure to put the routine as public but the syntax was wrong. I got it working now.

    Thanks,
    Mark

Posting Permissions

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