Results 1 to 5 of 5
  1. #1
    Join Date
    Apr 2007
    Posts
    108

    Unanswered: Knowing which button called a Sub?

    I have tons of button on a single form, they are used to rearrange the order of main buttons represting people (clicking on main buttons lets you chose which people performed a procedure and are ordered in 3 departments by hierarchy).

    So if you are not satisfied with the way main buttons are arranged (someone changes department or goes up or down in hierarchy you click on up and down auxilliary buttons).

    When I click up button ( for example near the 3rd department's 2nd button) I want to move caption and picture of button belonging to Department 3, Hierarchy 2 to Department 3 Hierarchy 1 and vice versa).

    Instead of having to place separate code in each of those 60 move up and move down buttons I want each of these buttons to...

    Call MoveButtonUP or MoveButtonDOWN procedures placed in forms procedures.

    That works fine, only when I'm in those procedures I WANT TO KNOW WHICH BUTTON CALLED THE SUB. CAN I KNOW THAT?

    Thanks!

  2. #2
    Join Date
    Apr 2007
    Posts
    108
    Or having a line of code in each of those button's OnClick events like...

    Call MoveButtonUP(Me.[NameOfMe - Button who's calling the procedure])

    ...would be fine, only I don't know how to self reference it!

  3. #3
    Join Date
    May 2005
    Location
    Nevada, USA
    Posts
    2,888
    Provided Answers: 6
    See if the ActiveControl Property works for you; more info in VBA Help.
    Paul

  4. #4
    Join Date
    Apr 2007
    Posts
    108
    Tried that before posting as it was my original idea, it didn't work then, but it works now, must have gotten something wrong!

    Thanks pbaldy!

  5. #5
    Join Date
    May 2005
    Location
    Nevada, USA
    Posts
    2,888
    Provided Answers: 6
    Glad it worked out for you.
    Paul

Posting Permissions

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