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

    Check my DB and see what Iam talking about

    I am posting my Access database so you can see what I am talking about. I want to eliminate tables tblPersonnel_1 and
    tblPersonnel_2. mydb.zip

    I tried to create a relationship between Personnel_ID, the primary key in tblPersonnel, and Approver_ID,
    the foreign key in tblTelework, and the foreign key in tblPropass.

    This was the last task that I did and it resulted in tblPersonnel_1 and tblPersonel_2. I would like them to be connected


    to tblPersonnel period no suffix with a number attached.

    Why can't I do this? As you can see Personnel_ID Approver_ID are in the same table tblTelework and tblPropass.

    The relationship with PersonnelID (as a foreign key) was already established in both tables.

    Any help appreciated. Thanks in advance.

    Respectfully,


    Lou_Reed

  2. #2
    CJ_London is online now VIP
    Windows 8 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,930
    If you are referring to the relationships view, this is just the way it works. It happens because you have (for example)two relationships between tblPersonnel and tblPropPass - one to approverID and one to PersonnelID and the relationships view cannot show them combined

  3. #3
    ssanfu is offline Master of Nothing
    Windows XP Access 2010 32bit
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    I would be more concerned with the naming convention. You have spaces in names, reserved words as field names and special characters in field names.
    "Type", "Number" and "Description" are reserved words and shouldn't be used for object names.
    Also, "(" and ")" in field names

  4. #4
    Lou_Reed is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2015
    Posts
    1,664
    Could you expand on this? I understand that reserved words should not be used, but spaces in names and { and } in names are not

    part of my understanding. I am only naming things according to the people that are paying me. If I change, I had better have a good reason. So
    on these last two points I need you to expand. What is wrong with spaces in names and what is wrong with { and} in names.

    Any help appreciated. Thanks in advance.


    Respectfully,


    Lou_Reed

  5. #5
    ssanfu is offline Master of Nothing
    Windows XP Access 2010 32bit
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    I understand that reserved words should not be used
    Besides being reserved words, reserved words are not usually descriptive. for example "Type". "Type of what"? "Number"...number of what? "Date" of what?
    At this point in time, you know what the field name means, but what about in 6 months or a year from now? Or a different programmer has to decipher the names.

    You have a field named "CorID (contract office represenative)". Do you really want to type that EVERY time you have to use it in code?
    I would put "(contract office represenative)" in the Description column of the table. Then the field name would be "CorID". Doesn't mean anything to me and I can't figure out what "Cor" might be. Even in context of the specific table, I can't figure out what it might mean.
    I might use "contractRepID".

    I see you use the suffix "ID" on PK and FK fields. And looking at the tables in design view, those fields are numbers. Very good. My convention is to use the suffixes "_PK" and "_FK" for primary and foreign keys.




    Spaces. Spaces are problematic. While Access allows spaces in object names, they are a real PITA. If you create a dB for your own use, do what you want. But for a professional dB that might at some point (even a 1 in a gazillion gazillion chance) might be converted to a major dB (SQL Server, MySQL, Oracle,etc), no spaces in names is the correct way to go since most major dBs do not allow spaces in object names.

    Same goes for using punctuation or special characters (except the underscore). Not allowed in the major RDBMS's. The hash sign ("#") is a date delimiter and hence a reserved word. I see fields named like "Phone #". So a space and a reserved word...... Argrh.

    If you do a lot of coding, spaces, punctuation and/or special characters becomes a pain to deal with; using brackets is extra typing. It doesn't pay to spend hours and hours troubleshooting syntax just because there's spaces or other odd characters in the field/table name - or a missing bracket. Do you know how long it can take to find 1 missing bracket??? It may not seem like a big deal, but when you're writing a lot of VBA code (now or in the future), it can save you lots of development/troubleshooting time.

    If you need to separate words in the name, use the underscore instead of a space. Or use CamelBack naming convention.



    These are the general rules I try to follow: (my conventions)
    1. No spaces in any field/table names.
    2. Don't start field/table names with numbers to try and order the field, query, for or report names (Access will do all kinds of weird things that are hard to troubleshoot - personal experience. ex: 1TableName or 2MyFieldName or 3_SomeFieldName...etc...Number suffix are ok.)
    3. Object names are letters or numbers. NO spaces, punctuation or special characters (exception is the underscore) (see #2)
    4. Avoid long field names (such as field names that are 100+ characters long!) I try to keep names between 5 and 10 characters. A good naming convention helps.
    5. ALWAYS take the time to use meaningful names for objects. Buttons named "Command1" or "Command127" aren't helpful when trying to troubleshoot errors. I've seen "Combo12", "List33", "Text57", "Query15", "Form22" ....this is just lazy programming. OK for your personal dB, but should NEVER be in a professional (Paid for) dB.

    At some point, you or another programmer will most likely need to modify the code. You can make it easy on yourself (or someone else) and save a lot of time by simply naming things properly/easier.

    Which of the following is easier to troubleshoot (this is a simple example but image a SQL statement with joins, etc.....):

    Code:
    strSQL = "Select FirstName, LastName From tblCustomers"
    or
    Code:
    strSQL = "Select [First name], [Last name] From [my customer table]"



    No one except programmers should see the object names, so what you name the objects really shouldn't matter to the client.
    The client might have some specifications to follow, but IMO, you still need to follow proper programming guidelines. This includes descriptions of the field names in the table that are not obvious/ easy to decipher and lots of comments in the VBA CODE.

    While I can decipher most dBs that are posted on the forum, there have been some real winners in the BAD NAMING category.



    ------------------------------------------------
    Database Table and Field Naming Suggestions
    http://www.databasejournal.com/featu...uggestions.htm


    NAMING CONVENTIONS
    http://access.mvps.org/access/genera...om/namconv.htm

    The point is: find a naming convention that works for you and stick with it. But be open to change. I have changes parts of my conventions several times.

  6. #6
    CJ_London is online now VIP
    Windows 8 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,930
    I am only naming things according to the people that are paying me.
    they will (or should) not be looking at tables and queries - use spaces in labels captions and/or use the caption property in the field properties

  7. #7
    Lou_Reed is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2015
    Posts
    1,664
    This link below:

    NAMING CONVENTIONS
    http://access.mvps.org/access/genera...om/namconv.htm


    results in a file not found.

    Respectfully,

    Lou_Reed

  8. #8
    ssanfu is offline Master of Nothing
    Windows XP Access 2010 32bit
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    Try this

    NAMING CONVENTIONS
    http://access.mvps.org/access/general/gen0012.htm


    You can find many sites on naming conventions.
    The point is: pick one and use it consistently, even if it changes over time.

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

Similar Threads

  1. Check all check boxes on continuous form
    By NISMOJim in forum Forms
    Replies: 7
    Last Post: 06-14-2016, 02:14 AM
  2. Replies: 3
    Last Post: 08-25-2014, 02:07 PM
  3. Replies: 5
    Last Post: 06-26-2014, 12:52 PM
  4. Replies: 4
    Last Post: 02-03-2014, 12:16 PM
  5. Check if record exists, Check Number
    By burrina in forum Forms
    Replies: 9
    Last Post: 01-06-2013, 03:49 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