Results 1 to 7 of 7
  1. #1
    tbjmobile@gmail.com is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Jan 2018
    Posts
    127

    What are the ideal fields for table relationships

    I was recently helped by various people on this forum for which I am very grateful, my thanks to all of them. During this process I was advised that using short text fields as linking fields, primary and foreign, was not good. I said I would look into this but I'm finding difficulty finding the answer so perhaps someone could point me to a source of information on this subject.
    The problem is that historically, my firm has used a customer code system and those codes are 001, 002 up to about 075. I can't easily change these to number fields because they obviously won't translate the leading zero/s to which everyone has become accustomed over the years. If it is going to lead to problems later on though, is it best to always use an Autonumber ID field in all of my tables in order to create the relationships, and still incorporate my customer field as it is now? Almost all of the tables are based on the customer codes as it is common throughout all the work that we do.


    Thank you.

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,550
    for customers, internally I use autonum. You CAN also assign your in-house Client# as string 001, etc..
    but internally, the system uses Client (autoNum) as a generated # and all related tables use this number.
    Works great. For the users, they can keep their human Client# if they need, and they wont know the difference.

  3. #3
    tbjmobile@gmail.com is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Jan 2018
    Posts
    127
    Thanks ranman256 (again).
    Do you mean use an autonumber field in (say) the tblCustomers table but not use it except for linking purposes? Then in (say) the tblWork table, use an autonumber field also, just for the link and use the "001" to identify the record linked to. The reason I have to ask is that almost all of my tables use the "001" to get the data from each other and so while in the tblCustomers, each record is unique, the tblWork will have loads of "001" s and the tblBookings will have lots of customer codes too. So should I use an autonumber field in all the tables just to link them together and then carry on as now and use the "external" customer codes to get the actual data used, that the staff and customers will see and that I use for grouping?
    Thanks.

  4. #4
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,550
    if youve already used the string field, that is fine. It still works.
    continue using them for customer links.

    it just means you have to create your own keys manually.

  5. #5
    tbjmobile@gmail.com is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Jan 2018
    Posts
    127
    Thank you.

  6. #6
    ssanfu is offline Master of Nothing
    Windows 7 32bit Access 2010 32bit
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    If you have been using a text field as a PK field, you can still use it, but it is not optimal. A PK field should not have any real world meaning.

    Here are reasons for using an autonumber as the PK field.
    Microsoft Access Tables: Primary Key Tips and Techniques
    http://www.fmsinc.com/free/newtips/primarykey.asp

  7. #7
    tbjmobile@gmail.com is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Jan 2018
    Posts
    127
    Understood, thank you both.

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

Similar Threads

  1. Replies: 5
    Last Post: 09-08-2017, 05:55 PM
  2. Replies: 1
    Last Post: 07-07-2017, 01:10 AM
  3. Relationships ID's and fields...
    By arrudac30 in forum Access
    Replies: 5
    Last Post: 08-15-2015, 01:32 AM
  4. Shared Database Ideal
    By asmores in forum Access
    Replies: 4
    Last Post: 10-16-2013, 06:50 PM
  5. Replies: 0
    Last Post: 06-15-2012, 05:58 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