Results 1 to 7 of 7
  1. #1
    tgavin is offline Novice
    Windows XP Access 2003
    Join Date
    Jul 2010
    Location
    New York
    Posts
    22

    numbering line entries

    I need to export a query to excel with PO and their line items. Each line item of a PO needs to be numbered, starting with 1000, then 2000, etc for each item of that PO. If the export contains 3 POs there would be 3 sets of line items starting with 1000. I am not worried about the 0s, just how to count per PO. Any one have any ideas on how do I do this?

    Thanks
    Terri

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Presuming there's an ID field you can use to sort, you either use DCount() or a subquery that counts all records with an ID field less than or equal to the current record, with a further criteria on PO. That gets you 1, 2, 3. From there you just multiply by 1000.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    tgavin is offline Novice
    Windows XP Access 2003
    Join Date
    Jul 2010
    Location
    New York
    Posts
    22
    Paul, I am doing something wrong. I have 2 different POs, one with 2 items, 1 with 1.

    Here is my formula
    PDLNID: DCount("[PurchaseID]","qryLineCount","[intPO]=[intPO]")

    Here is what it returns
    qryPODetailExportPO#PDDCTOPDSFXOPurchaseIDPDLNID70675OD0003036370675OD0003252370705OD00032673
    Here is what I need it to return
    PO#PDDCTOPDSFXOPurchaseIDPDLNID70675OD0003036170675OD0003252270705OD00032671

  4. #4
    tgavin is offline Novice
    Windows XP Access 2003
    Join Date
    Jul 2010
    Location
    New York
    Posts
    22
    That is not reading right
    PO# (space)
    PDDCTO (space)
    PDSFXO (space)
    PurchaseID (space)
    PDLNID (new line)
    70675 (space)
    OD (space)
    000 (space)
    3 or 1 (new line)
    70675 (space)
    OD (space)
    000 (space)
    3 or 2 (new line)
    70705 (space)
    OD (space)
    000 (space)
    3 or 1 (new line)

    Sorry about that.

  5. #5
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Is PurchaseID a unique value in that table? Like I said, you also need the second criteria, not just PO number. If that's a unique value, try

    DCount("*","qryLineCount","[intPO]=" & [intPO] & " AND PurchaseID <=" & PurchaseID)
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  6. #6
    tgavin is offline Novice
    Windows XP Access 2003
    Join Date
    Jul 2010
    Location
    New York
    Posts
    22
    Yes!!!!

    Thank you so much.

  7. #7
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    No problemo!
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

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

Similar Threads

  1. HELP with crazy receipt numbering
    By jlm722 in forum Forms
    Replies: 15
    Last Post: 09-23-2009, 01:49 PM
  2. Help with Sequential Numbering
    By orion in forum Programming
    Replies: 3
    Last Post: 07-06-2009, 01:41 PM
  3. Numbering records
    By knightjp in forum Database Design
    Replies: 0
    Last Post: 08-17-2008, 07:07 AM
  4. Auto Numbering
    By rkruczk in forum Forms
    Replies: 0
    Last Post: 10-09-2006, 04:25 AM
  5. Page numbering glitch
    By kfinpgh in forum Reports
    Replies: 3
    Last Post: 08-17-2006, 08:23 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