Results 1 to 4 of 4
  1. #1
    anoob is offline Advanced Beginner
    Windows 7 64bit Access 2007
    Join Date
    Jan 2011
    Posts
    60

    AutoNumber Info

    Hello all, I just had a quick couple questions about AutoNumber fields...




    1. In order to us the Primary Key AutoNumber field "Client ID" as a Foreign Key in another field - does the FK have to be set to the type "number"?


    2. Does the FK name/title have to be the same, in this example "Client ID", or could they hypothetically be different? FK "Related ID From Clients"


    3. If you format the data in the PK AutoNumber field as such:

    "Client-0001", "Client-0002" etc.

    Is it misleading because under the formatting the number in the table is just "1", "2", and so on? Would this screw up a search for one of the formatted IDs?


    4. Is it bad practice to name tables or other rows or whatever with spaces in the name? Should "My Row" be "MyRow" or "My_Row"?

    Many thanks - I'm new to this so I appreciate the guided help. I've read so many random Google searches the past week my brain is just toast...

  2. #2
    SteveH2508 is offline Competent Performer
    Windows XP Access 2000
    Join Date
    Sep 2010
    Location
    Chelsea, London, England
    Posts
    116
    Quote Originally Posted by anoob View Post
    Hello all, I just had a quick couple questions about AutoNumber fields...


    1. In order to us the Primary Key AutoNumber field "Client ID" as a Foreign Key in another field - does the FK have to be set to the type "number"?
    Yes - it must be Long integer

    2. Does the FK name/title have to be the same, in this example "Client ID", or could they hypothetically be different? FK "Related ID From Clients"
    No

    3. If you format the data in the PK AutoNumber field as such:

    "Client-0001", "Client-0002" etc.

    Is it misleading because under the formatting the number in the table is just "1", "2", and so on? Would this screw up a search for one of the formatted IDs?
    Yes it is misleading - not sure about the search question

    4. Is it bad practice to name tables or other rows or whatever with spaces in the name? Should "My Row" be "MyRow" or "My_Row"?
    Yes - it will cause tears before bedtime at some stage (as will odd characters like # etc.)
    Many thanks - I'm new to this so I appreciate the guided help. I've read so many random Google searches the past week my brain is just toast...
    Just my thoughts - others mileage may vary.

  3. #3
    anoob is offline Advanced Beginner
    Windows 7 64bit Access 2007
    Join Date
    Jan 2011
    Posts
    60
    Great response - thank you.

    Is there a way then to set the format of the AutoNumber at the actual level where it is stored? So instead of it storing 1 through whatever, it would store "000001", "000002" etc?

  4. #4
    SteveF is offline Generally AccessAble
    Windows XP Access 2010 (version 14.0)
    Join Date
    Nov 2010
    Location
    Fourth Corner
    Posts
    123
    Quote Originally Posted by anoob View Post
    Great response - thank you.

    Is there a way then to set the format of the AutoNumber at the actual level where it is stored? So instead of it storing 1 through whatever, it would store "000001", "000002" etc?
    To make the answer short: no. If you must have leading zeroes for display in a form or report, use a query as the form/report's data source and use the Format Function within the query to add the zeroes.

    Steve

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

Similar Threads

  1. duplicate autonumber
    By rayc in forum Access
    Replies: 5
    Last Post: 06-19-2013, 07:50 AM
  2. Autonumber gone crazy
    By asearle in forum Access
    Replies: 1
    Last Post: 07-27-2010, 05:41 AM
  3. Add prefix to AutoNumber
    By sirmilt in forum Database Design
    Replies: 3
    Last Post: 07-09-2010, 01:41 PM
  4. Controlling autonumber
    By Patience in forum Access
    Replies: 3
    Last Post: 06-22-2010, 04:11 AM
  5. AUTONUMBER
    By J A F F A in forum Database Design
    Replies: 1
    Last Post: 10-03-2007, 10:30 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