Results 1 to 8 of 8
  1. #1
    texanmike02 is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Nov 2013
    Posts
    5

    loading a button caption to a global variable

    I have a form with up to 100 buttons generated based on a number of conditions. I am trying to pass the caption of a button to a sub so that I can open the correct forms. When a button is clicked how can I read it's caption. Me.caption is reading the form caption.

    Thanks,
    Mike

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,641
    Me.ButtonName.Caption
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    texanmike02 is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Nov 2013
    Posts
    5
    Quote Originally Posted by pbaldy View Post
    Me.ButtonName.Caption
    Is there a way to tell which button was just clicked?

    I want to have one function that opens the correct form instead of creating 30 different functions so

    Function openselectedfrm(buttoncaption)
    Docmd.open acform, button caption
    End function works

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,641
    Check out ActiveControl in VBA help and see if it works for you.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    texanmike02 is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Nov 2013
    Posts
    5
    Quote Originally Posted by pbaldy View Post
    Me.ButtonName.Caption


    Quote Originally Posted by pbaldy View Post
    Check out ActiveControl in VBA help and see if it works for you.
    Worked like a dream

  6. #6
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,641
    Glad it worked for you. Welcome to the site by the way!
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  7. #7
    texanmike02 is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Nov 2013
    Posts
    5
    Quote Originally Posted by pbaldy View Post
    Me.ButtonName.Caption
    Thanks. Because of work requirements I have been forced to work in excel for most of my projects (turned it into a flat file data repository with Excel as an interface that relies heavily on vba and COBOL emulation I wrote.) but I have successfully made the case to move to access.

    Is there any place i can look for theming? I need to get rid of the square that the record selector goes. Turned off the record selector but still have the little square.

    Mike

  8. #8
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,641
    I'm not clear on what square you're referring to.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Can't See Global Variable
    By CementCarver in forum Programming
    Replies: 12
    Last Post: 09-19-2013, 12:28 PM
  2. How to use global/public variable
    By mrbabji in forum Programming
    Replies: 7
    Last Post: 05-18-2013, 10:08 PM
  3. Global variable
    By ramdandi in forum Queries
    Replies: 3
    Last Post: 12-18-2011, 01:01 AM
  4. Replies: 4
    Last Post: 07-14-2011, 12:55 PM
  5. How to declare Global Variable
    By ganeshvenkatram in forum Access
    Replies: 1
    Last Post: 06-16-2011, 05:18 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums