Results 1 to 5 of 5
  1. #1
    Lou_Reed is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2015
    Posts
    1,664

    Command Buttin Names in VBA code

    What is the relationship between the name of a button on a form and the name that is in the properties in the VBA code?

    I ask this because I can create a button a put the word clear on it. First putting the form in design view.

    Then press f4 and get properties, then go to event tab in the sheet, click ellipsis and the box opens up and select code, and it will show
    something like Command01_click in the VBA, which is not descriptive.

    Now since all of these things are connected simply changing the name in the code to Clear_button_click,, I assume would cause
    problems.

    Any help appreciated Thanks in advance.

    Respectfully,

    Lou Reed

  2. #2
    ranman256's Avatar
    ranman256 is online now VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,521
    Select the button,
    view the properties,
    the NAME property can be changed to a descriptive one, btnClear
    then click the event ellipsis, you'll get :
    sub btnClick_click()

    if you've already made code, it will be a hassle to change if you have a lot.

  3. #3
    Lou_Reed is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2015
    Posts
    1,664
    Okay. That seems to work. Thanks

    Respectfully

    Lou Reed

  4. #4
    HiTechCoach's Avatar
    HiTechCoach is offline MS MVP - Access Expert
    Windows 8 Access 2013
    Join Date
    Jul 2010
    Location
    Oklahoma, USA
    Posts
    702
    TIP: The first thing I do after adding a command button is to change the name property. I do this before doing anything else.

  5. #5
    Lou_Reed is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2015
    Posts
    1,664
    Please explain this statement below. I need to know more about what you said.

    TIP: The first thing I do after adding a command button is to change the name property. I do this before doing anything else.

    Thanks in advance.

    Respectfully,


    Lou Reed

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

Similar Threads

  1. Replies: 3
    Last Post: 03-29-2015, 07:42 PM
  2. Replies: 2
    Last Post: 11-06-2013, 10:43 AM
  3. Command buttons and Code
    By Jillette in forum Forms
    Replies: 4
    Last Post: 04-25-2012, 05:06 PM
  4. Replies: 1
    Last Post: 02-12-2011, 10:30 AM
  5. Command button code
    By lfolger in forum Forms
    Replies: 3
    Last Post: 03-25-2008, 04:26 PM

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