Results 1 to 5 of 5
  1. #1
    Join Date
    Jun 2011
    Location
    Inside your mind
    Posts
    297

    Unanswered: Cross Form Event Precedures

    Just a quick one...

    Never had to try and do anything like this before, and basically wondering if it's possible, or whether I'm being a little too enthusiastic about VBA's capabilities.

    Basically:

    Code:
    DoCmd.OpenForm ("adminForm_manualPCode")
    [Form_adminForm_manualPCode].manualPCodePCode.Value = inputAns
    [Form_adminForm_manualPCode].manualPCodeValidate_Click
    Doesn't work... Is there a sneaky way to get it to click that button from a seperate form? Or is it simply not possible?

    Thanks in advance fella's.
    Last edited by kez1304; 08-18-11 at 09:58.
    Looking for the perfect beer...

  2. #2
    Join Date
    Mar 2009
    Location
    Dorset
    Posts
    119
    When you say click the button do you just mean run the code that's attached to the button?
    If so you could just put the code in a public module and call it form the 2 different places.
    Regards
    JD

    Software-Matters

  3. #3
    Join Date
    Mar 2009
    Posts
    5,442
    Provided Answers: 14
    By default, event handling procedures are declared as Private Sub, however nothing prevents you from making them public:
    Code:
    Public manualPCodeValidate_Click()
    Have a nice day!

  4. #4
    Join Date
    Jun 2011
    Location
    Inside your mind
    Posts
    297
    See, I've programmed in Java everyday, for the last four years, and never thought to change the routine (or method) to public...

    For some reason I just don't view VBA to be a fairly powerful OO language, when clearly it can handle more than I give it credit.

    Thanks for the replies guys!

    Just wish I could find that facepalm smiley...
    Looking for the perfect beer...

  5. #5
    Join Date
    Mar 2009
    Posts
    5,442
    Provided Answers: 14
    You're welcome!

    Except for true inheritance and abstract classes, VB/VBA is more powerful than many people believe.
    Have a nice day!

Posting Permissions

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