Results 1 to 4 of 4
  1. #1
    Yesideez is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Jun 2011
    Location
    Devon, UK
    Posts
    17

    Naming conventions

    I've been programming for almost all my life and I've got some deep habits when it comes to programming and as I'm just starting out in Access I'm wanting to get things right now to save me a massive headache later on.



    Every language I've used has no spaces in variable names. Al my tables and fields in MySQL all contained no spaces and I had a strict naming convention to help tell things apart. For example, a field in a table which was linked to the primary key in another table always started with an underscore.

    How does spaces in field names affect the use of variables when programming and am I best to strip them all out?

    for example, in one table I've got field names like "Property ID", "Agent ID", "Post Code", "Gas Checks Required" and so on.

  2. #2
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows XP Access 2003
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,544
    Hi

    I believe I am correct in saying that Access/VBA can can handle names with spaces like "Property ID" as long as they are enclosed in square brackets "[Property ID]". That said, I always avoid using spaces.
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

  3. #3
    Yesideez is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Jun 2011
    Location
    Devon, UK
    Posts
    17
    Thanks

    I'd prefer to avoid using spaces as it's more of a "comfortable habit" but the end user of this database has Access experience and I'm not sure how he'll cope if I strip out the spaces.

    Remembering back from my dBase days the forms I'm just starting to get my head in I can change the text (variables/fields) to something more meaningful without "breaking" functionality.

  4. #4
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,726
    Even though it is possible to use spaces in field and object names, it is frowned upon. You will need the square brackets for every use. Better to not use spaces, nor special characters in field and object names. Also, there are some reserved words in Access that can also be an issue.
    Here's a link to reserved words
    http://allenbrowne.com/AppIssueBadWord.html

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

Similar Threads

  1. Naming a Calculated Field
    By wscott in forum Reports
    Replies: 4
    Last Post: 10-11-2010, 02:20 AM
  2. Table naming - use prefix or not?
    By revnice in forum Access
    Replies: 4
    Last Post: 08-08-2010, 11:55 AM
  3. Replies: 0
    Last Post: 07-13-2010, 07:45 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