Results 1 to 8 of 8
  1. #1
    RLehrbass is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    May 2015
    Posts
    102

    Naming convention question? btn or cmd?

    Considering that I am fairly new to Access development, I come with few bad habits. So I want to keep it that way.
    What is the most common naming of a command button? btnXXXX or cmdXXXX?
    I understand it is a taste thing but what is the better choice?

  2. #2
    LaughingBull is offline Competent Performer
    Windows 8 Access 2013
    Join Date
    Jul 2015
    Location
    Toledo Ohio
    Posts
    143
    butopenform

  3. #3
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    I use cmd, but I wouldn't call it better. I think it's personal preference, and probably most important is consistently applying whatever naming convention you choose.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  4. #4
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,902
    What is best? - neither and both. There are different 'flavors' of buttons - command, toggle, radio. So if you want 'btn' to mean only the command button in your db, then fine that works as well as cmd. Then can use rdo, tgl for the others. Just be consistent.

    I use btn but then I've never used toggle buttons and seldom use radio buttons.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  5. #5
    RLehrbass is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    May 2015
    Posts
    102
    So, if i choose btn, rdo, tgl etc... most developers will understand and accept my convention and I will have more descriptive code then if I use cmd for all of these?

  6. #6
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,902
    That seems a little backwards. In my mind, cmd would be more specific (command button) than btn - probably why cmd is Paul's preference.

    I got in the habit of using btn before I really learned about toggles and radios.

    Regardless, experienced developers will figure it out.

    Then there are other controls. I use tbx, cbx, lbx, lbl, lin, box, ctr.

    Some even like to use prefixes for field names - a text field might be txt, other fields like: num, mem, hyp, att.

    And prefixes for objects: tbl, qry, frm, rpt.

    How far you want to take this is up to you.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  7. #7
    RLehrbass is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    May 2015
    Posts
    102
    thanks for your thoughts on this issue.

  8. #8
    JeroenMioch's Avatar
    JeroenMioch is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    May 2012
    Location
    Den Haag, Netherlands
    Posts
    368
    Same here, btn, fld, ctrl, lbl, frm, qry, rpt etc..
    I used to use Dutch abbreviations, but more often im using English ones. Easier to understand for English speaking people when i post problems here ^^

    Also be consistent with naming of controls and such, like no spaces !! no underscores and such.

    ctrlLicencePlateNumber
    btnOpenFormVehicles
    rptTotalCostRepairs

    Gives you an immediate idea what the function is.

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

Similar Threads

  1. Access & sage folder name convention
    By FJM in forum Access
    Replies: 3
    Last Post: 08-06-2015, 08:19 AM
  2. I use my own VBA naming "convention"
    By keviny04 in forum Modules
    Replies: 13
    Last Post: 06-05-2015, 03:09 AM
  3. runtime error 49 bad dll calling convention
    By mujaqo in forum Programming
    Replies: 8
    Last Post: 01-14-2014, 06:00 AM
  4. Naming scheme thru VBA
    By redbull in forum Programming
    Replies: 10
    Last Post: 04-10-2012, 02:37 PM
  5. Newbie question re naming columns
    By Kola in forum Access
    Replies: 4
    Last Post: 10-03-2011, 06:44 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