Results 1 to 2 of 2
  1. #1
    Lesg is offline Competent Performer
    Windows 10 Office 365
    Join Date
    Sep 2021
    Posts
    101

    custom product code numbering within a primary table


    Hi Guys, just looking for ideas on how I should approach the following client request.

    We have a primary table tblproducts and all products have been traditionally identified as via the primary key productID

    Overtime this table has become full of products that the client is now working to slim down to a 'product range' they want to be there listed products as part of this process clients is wanting to create a new numbering method to identify product by code range i.e. frozen products range 20,000-29,999 then fresh products in range 40,000 - 49,999 etc. the idea being a new column 'code' added the tblproducts. Products are already assigned to these categories by link table, but they now want to have this numbering method.

    So I am looking for a way client will be able to add products into these ranges, ensuring all numbers are sequential and unique so any thoughts or suggestions on the best way to do this would be appreciated.

  2. #2
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,445
    seems a waste of time to me - what is the benefit?

    but if you want to do it perhaps use an update query along the lines of

    Update tblProducts SET Code=20000+dcount("*","tblProducts","productPK<" & productPK) WHERE CategoryFK=1

    run for each category, changing the 20000 and modify the where clause to however your are assigning them at the moment

    and pray the client never has more than 10000 products for any given category

    moving forward, to populate the code field for new products, google "dmax+1"

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

Similar Threads

  1. Custom Primary Key Append to Another Table
    By dave_co in forum Access
    Replies: 5
    Last Post: 06-18-2020, 08:25 AM
  2. Replies: 5
    Last Post: 03-21-2015, 01:42 PM
  3. Replies: 6
    Last Post: 02-28-2015, 11:57 AM
  4. Sharepoint Custom Primary Key?
    By Steven.Allman in forum SharePoint
    Replies: 1
    Last Post: 06-20-2014, 11:06 AM
  5. Custom Page Numbering Help
    By RayMilhon in forum Reports
    Replies: 2
    Last Post: 04-26-2012, 03:57 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