Results 1 to 4 of 4
  1. #1
    Nhung is offline Novice
    Windows 10 Access 2013 64bit
    Join Date
    May 2018
    Posts
    3

    Arrow create Automatic number for each item in the Detail Order table

    Hello guru,



    I have 2 tables: Order table and Order Detail table
    (Order table has fields: OrderID, date)
    Order Detail table has fields: OrderID, Sequence number, product, quantity)

    Now I create a form along with a sub form to enter data for Order and Order detail.

    My requirement: I need the "Sequence number field" is created Automatically with auto number for each Order (not for all order). It means that in the sub form, when user input data for the next record, system create the new number = above number +1 automatically

    Order 1:

    Sequence number Product Quantity
    1 Shoes 20
    2 Skirt 30
    3 Hat 40



    Order 2:

    Sequence number Product Quantity
    1 Book 40
    2 Mug 20
    3 Hat 10
    4 Paper 6


    Click image for larger version. 

Name:	Automatic Number for each item in Order detail table.png 
Views:	19 
Size:	20.2 KB 
ID:	34599

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    Generating custom sequential ID within a group and saving in field requires code. This is a common topic and has been answered many times. Search forum and web for examples.

    Alternatively, textbox on report has RunningSum property which can be used to calculate this sequential number on report.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    CJ_London is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,933
    As June says, a common topic - refine your search by looking for 'dmax+1'

  4. #4
    orange's Avatar
    orange is offline Moderator
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,870
    nhung,
    You have responses to your specific question, but there must be more to your database.
    Order and OrderDetail makes me wonder where are Customer, Product, Supplier...?

    I don't see Price in your OrderDetail table.
    Good luck.

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

Similar Threads

  1. best way to create an Order Number
    By ShaunG in forum Programming
    Replies: 8
    Last Post: 01-22-2018, 04:49 AM
  2. Replies: 3
    Last Post: 01-11-2018, 08:12 PM
  3. Replies: 2
    Last Post: 03-07-2016, 05:02 PM
  4. Add New Line Item Detail to Invoice Based on Status
    By breakingme10 in forum Programming
    Replies: 2
    Last Post: 06-23-2014, 04:04 PM
  5. Help generating line item number in order table
    By acenumber5 in forum Queries
    Replies: 18
    Last Post: 08-23-2012, 12:50 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