Results 1 to 6 of 6
  1. #1
    stildawn is offline Competent Performer
    Windows 10 Office 365
    Join Date
    Oct 2013
    Posts
    185

    Extra Autonumber Field On Table For Each Unique ID Number

    Hi All

    Not sure how to describe this but here goes.

    I have a table as below:

    PrimaryKeyID (Autonumber) FRTRatesID (linked to FRTRates table) Name Value OrderBy

    PrimaryKeyID - Standard issue autonumber, no duplicates unique for each record
    FRTRatesID - A unique number from FRTRates table, however on this table can be multiple records with the same number (so they all link to 1 record on FRTRates table)


    Name - Simply a text field for the value name
    Value - Currency value
    OrderBy - This is the field I need help with, I want it to autonumber starting from 1 for each unique FRTRatesID number..


    So an example of what I want a set of data to look like:

    PrimaryKeyID (Autonumber) FRTRatesID (linked to FRTRates table) Name Value OrderBy
    1 1 Terminal $100 1
    2 1 Docs $50 2
    3 1 Admin $30 3
    4 2 Terminal $200 1
    5 2 Docs $100 2
    6 2 Admin $80 3

    So you can see for FRTRateID 1 there is 1, 2, 3 in the OrderBy, same for FRTRateID2, I want this OrderBy to autopopulate.

    This is so a user later on in the database can change them to order however they like, so if they wanted Docs to be first they could change it to a 1 etc.

    Is this possible?

    Cheers

  2. #2
    isladogs's Avatar
    isladogs is offline Access MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    6,204
    You can only have one autonumber field in a table so that isn't possible.
    You need to create a rank order by group where the FRTRatesID field is the group value.
    To do this you need a subquery.
    I did something similar yesterday in another thread at a different forum. See post #19 in this thread https://www.access-programmers.co.uk.../#post-1780147
    Colin Riddington, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I know I don't know, I keep quiet!

  3. #3
    ssanfu is offline Master of Nothing
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    Be aware that "Name", "Value" & "OrderBy" are reserved words in Access and shouldn't be used for object names.
    Plus, "Name" and "Value" are not very descriptive - Name of what? Value of what?

    See Problem names and reserved words in Access

  4. #4
    stildawn is offline Competent Performer
    Windows 10 Office 365
    Join Date
    Oct 2013
    Posts
    185
    Quote Originally Posted by ssanfu View Post
    Be aware that "Name", "Value" & "OrderBy" are reserved words in Access and shouldn't be used for object names.
    Plus, "Name" and "Value" are not very descriptive - Name of what? Value of what?

    See Problem names and reserved words in Access
    Yeah I know, sorry they are not actually called that, its just for simplicities sake on the internet

  5. #5
    stildawn is offline Competent Performer
    Windows 10 Office 365
    Join Date
    Oct 2013
    Posts
    185
    Quote Originally Posted by isladogs View Post
    You can only have one autonumber field in a table so that isn't possible.
    You need to create a rank order by group where the FRTRatesID field is the group value.
    To do this you need a subquery.
    I did something similar yesterday in another thread at a different forum. See post #19 in this thread https://www.access-programmers.co.uk.../#post-1780147
    Thanks will take a look

  6. #6
    Micron is offline Very Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    13,421
    Why don't you just order by the PK of FRTRates table? What difference would it make if the order is 1,2,3 for FRTRates(1) or if 4,5,6 for FRTRates(2)? Or does the rates table not have an autonumber (or similar) ID field?
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

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

Similar Threads

  1. changing a number field to a autonumber
    By yosteee in forum Access
    Replies: 5
    Last Post: 02-28-2018, 02:47 PM
  2. Replies: 3
    Last Post: 09-26-2017, 11:19 PM
  3. Replies: 3
    Last Post: 06-08-2017, 08:03 PM
  4. Replies: 2
    Last Post: 03-19-2013, 09:36 PM
  5. Replies: 8
    Last Post: 01-30-2013, 06:40 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