Results 1 to 9 of 9
  1. #1
    ShaunG is offline Competent Performer
    Windows 7 64bit Access 2007
    Join Date
    Jan 2018
    Posts
    237

    best way to create an Order Number

    I thought I had it sussed but maybe not so much....



    I want to create an Order number which automatically populates when a new order form is opened.... but the tricky part is im trying to keep this number as small as I can while combining, not adding the - Job Number, UnitID, and ItemID = Order Number.

    We can have Multiple units per Job and Multiple Items per Unit, but not more then 100 for either.

    every new Job Number Im trying to get the UnitID To start at 1 and every New UnitID to start at 1 also.... otherwise the order Number will get massive real quick, also I im trying not to add the number together I want to combine it.

    example - Job Number 1112, UnitID 1, and ItemID 1 = 1112001001 the reason for combining and not adding is you can use the number to work out which job, unit and order it is for.

    is this the best way to achieve what I want.... or is there a better way to get an order number that wont repeat itself and is small.

    this is what I thought

    =[tblJobDetails]![JobNumber]*100+[tblJoineryUnit]![UnitID]*100+[tblOrders]![ItemIID]

  2. #2
    SodaPop is offline Novice
    Windows 8 Access 2007
    Join Date
    Mar 2014
    Posts
    16
    Quote Originally Posted by ShaunG View Post
    I thought I had it sussed but maybe not so much....

    I want to create an Order number which automatically populates when a new order form is opened.... but the tricky part is im trying to keep this number as small as I can while combining, not adding the - Job Number, UnitID, and ItemID = Order Number.

    We can have Multiple units per Job and Multiple Items per Unit, but not more then 100 for either.

    every new Job Number Im trying to get the UnitID To start at 1 and every New UnitID to start at 1 also.... otherwise the order Number will get massive real quick, also I im trying not to add the number together I want to combine it.

    example - Job Number 1112, UnitID 1, and ItemID 1 = 1112001001 the reason for combining and not adding is you can use the number to work out which job, unit and order it is for.

    is this the best way to achieve what I want.... or is there a better way to get an order number that wont repeat itself and is small.

    this is what I thought

    =[tblJobDetails]![JobNumber]*100+[tblJoineryUnit]![UnitID]*100+[tblOrders]![ItemIID]
    I'll always say don't do that. Just use autonumber unless for example job 900 always = "brakes" or some other static value. No good reason to attempt to make a p.o. smart.

    Sent from my SM-G950U using Tapatalk

  3. #3
    ShaunG is offline Competent Performer
    Windows 7 64bit Access 2007
    Join Date
    Jan 2018
    Posts
    237
    Quote Originally Posted by SodaPop View Post
    I'll always say don't do that. Just use autonumber unless for example job 900 always = "brakes" or some other static value. No good reason to attempt to make a p.o. smart.

    Sent from my SM-G950U using Tapatalk
    I was really hoping to use it.... using auto number the order no in a year or 2 will be massive

    have you experience a lot of problems with what im trying to do.

  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,726
    using auto number the order no in a year or 2 will be massive
    How many Orders per year do you anticipate?
    Do yourself a real favor--DO NOT TRY TO CODIFY/CONCOCT A CODE WITH INTELLIGENCE!!!

    Relational database works very well (as designed) 1 fact 1 field.
    If you must display some combination, you can concatenate the individual fields(for presentation).

    Read the attached file for guiding database principles.
    Attached Files Attached Files

  5. #5
    SodaPop is offline Novice
    Windows 8 Access 2007
    Join Date
    Mar 2014
    Posts
    16
    Quote Originally Posted by ShaunG View Post
    I was really hoping to use it.... using auto number the order no in a year or 2 will be massive

    have you experience a lot of problems with what im trying to do.
    Yes, you end up painted in corner and constantly have to conform to your own rules as the business changes. It becomes problematic. What if you change job Id's or item Id's?

    100% of major outfits I've worked around like Wal-Mart and JB Hunt use standard PO incrementing. Well Wal-Mart did have Distribution center in their Po's up until a couple years ago but they dropped it.

    The reality is the number means nothing. It is a way to link detail and that is it. Someone might say, what was the cost on PO 12345 and you can look it up which is easier than looking up work done on Tuesday for customer y. That is the only purpose, a reference.

    I would just run a 10 digit auto number and start over at 9999999999. That's a lot of PO's. I bet you can go quite few year on them. Starting over is not an issue if you remember the p.o. is just a reference. I worked for 1 company with so much activity we'd see the same p.o. a couple times a year. It isn't a problem.

    Short version is there is no good reason to use a smart p.o. in 90% of applications and it us way easier to use autonumber.

    But you have to do it how it's best for you. If you want to concatenate the numbers I would do it as a string instead of number, not sure you'll get what you want adding them.

    Sent from my SM-G950U using Tapatalk

  6. #6
    ShaunG is offline Competent Performer
    Windows 7 64bit Access 2007
    Join Date
    Jan 2018
    Posts
    237
    Quote Originally Posted by orange View Post
    How many Orders per year do you anticipate?
    Do yourself a real favor--DO NOT TRY TO CODIFY/CONCOCT A CODE WITH INTELLIGENCE!!!

    Relational database works very well (as designed) 1 fact 1 field.
    If you must display some combination, you can concatenate the individual fields(for presentation).

    Read the attached file for guiding database principles.
    we do any where from 6 -20 per day which would = to 1500 - 5000 per year (working days)

    Working it out on paper, I guess its not that bad - 5 digit order number for roughly 20 years then 6 digit number after that.... that's working it out at max

    the main reason for what I wanted was to easily look at an order and no what its for.

    DO NOT TRY TO CODIFY/CONCOCT A CODE WITH INTELLIGENCE - so adding multiple fields to get an outcome in other words, ive done my best at normalisations and keeping the forms correct with the help of other reading as well.

    If you must display some combination, you can concatenate the individual fields(for presentation). - what do you mean by this can it record the outcome back to table or purely for looks at the time?

  7. #7
    ShaunG is offline Competent Performer
    Windows 7 64bit Access 2007
    Join Date
    Jan 2018
    Posts
    237
    Quote Originally Posted by SodaPop View Post
    Yes, you end up painted in corner and constantly have to conform to your own rules as the business changes. It becomes problematic. What if you change job Id's or item Id's?

    100% of major outfits I've worked around like Wal-Mart and JB Hunt use standard PO incrementing. Well Wal-Mart did have Distribution center in their Po's up until a couple years ago but they dropped it.

    The reality is the number means nothing. It is a way to link detail and that is it. Someone might say, what was the cost on PO 12345 and you can look it up which is easier than looking up work done on Tuesday for customer y. That is the only purpose, a reference.

    I would just run a 10 digit auto number and start over at 9999999999. That's a lot of PO's. I bet you can go quite few year on them. Starting over is not an issue if you remember the p.o. is just a reference. I worked for 1 company with so much activity we'd see the same p.o. a couple times a year. It isn't a problem.

    Short version is there is no good reason to use a smart p.o. in 90% of applications and it us way easier to use autonumber.

    But you have to do it how it's best for you. If you want to concatenate the numbers I would do it as a string instead of number, not sure you'll get what you want adding them.

    Sent from my SM-G950U using Tapatalk
    yeah my problem was I actually didn't do the maths on paper with auto numbers and it isn't as bad as I originally thought..... so im happy to go with that

    does auto number go endlessly?

    if there are double ups of an order number when you try to filter it isn't that where the issues will lie?

  8. #8
    Minty is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2017
    Location
    UK - Wiltshire
    Posts
    3,003
    An Autonumber Primary key will always be unique.
    You can't guarantee that it will be sequential, but again when you stop and think about it, that doesn't actually matter either.

    Like all the other posters have said, and you have accepted - it's just an identifier, keep it simple and your life as database twiddler will be also be kept simple.
    DLookup Syntax and others http://access.mvps.org/access/general/gen0018.htm
    Please use the star below the post to say thanks if we have helped !
    ↓↓ It's down here ↓↓

  9. #9
    ShaunG is offline Competent Performer
    Windows 7 64bit Access 2007
    Join Date
    Jan 2018
    Posts
    237
    Quote Originally Posted by Minty View Post
    An Autonumber Primary key will always be unique.
    You can't guarantee that it will be sequential, but again when you stop and think about it, that doesn't actually matter either.

    Like all the other posters have said, and you have accepted - it's just an identifier, keep it simple and your life as database twiddler will be also be kept simple.

    simply and working is what im after... cheers for the advise

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

Similar Threads

  1. Replies: 2
    Last Post: 03-07-2016, 05:02 PM
  2. Replies: 3
    Last Post: 02-09-2016, 04:36 PM
  3. Replies: 3
    Last Post: 01-18-2015, 06:05 PM
  4. Replies: 16
    Last Post: 06-20-2013, 09:25 AM
  5. display order number
    By Hopeless in forum Forms
    Replies: 3
    Last Post: 08-25-2012, 06:46 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