Results 1 to 6 of 6
  1. #1
    shockerty is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Aug 2014
    Posts
    4

    Date based reference number

    Hi all,



    I am trying to generate a date based reference number for deliveries. The reference needs 8 digits; the first 6 from the date and the last 2 as increments from 01.

    e.g.
    The 3rd delivery today would have the number 31081403

    I have a table with:
    • ID (Autonumber)
    • DeliveryDate (Short Date)
    • DeliveredBy (Lookup to couriers)
    • Sender (Lookup to suppliers)
    • FAO (Lookup to staff)
    • SenderRef (Short Text)
    • Notes (Long Text)


    I then created a query from that table with:
    • ID
    • DeliveryDate

    And the expression:
    • DateNum: CStr(Format([DeliveryDate],"ddmmyy"))


    This has given me a 6 digit string for the date. Not sure if I've gone down the right track or what to do next!

    Any ideas?

    Thanks

  2. #2
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,849
    Just curious why you "need" this?
    Often easier to have -- 1 fact 1 field and concatenate such fields as needed if/when necessary for display.
    Why do you need the sequence/increment number?

    I'm not saying you can't, I'm trying to determine what you need.
    Can you show us a jpg of your tables and relationships?
    Can you describe this database in more detail?

  3. #3
    shockerty is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Aug 2014
    Posts
    4
    I am taking a legacy paper reference format and trying to make a database. There are often multiple deliveries in a day and so the increment is needed.

    I think i will probably use the (autonumber) ID as the primary key, however end users will need to be able to search/sort using the 8 digit number.

    Click image for larger version. 

Name:	DeliveryNumber.jpg 
Views:	8 
Size:	50.1 KB 
ID:	17981
    Does that make sense?

  4. #4
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,849
    It might be easier for readers to understand your situation if you could expand on your description.
    The old who, what , where, when, how much and how often sort of approach.
    If autonumbers are to mean anything to the user, then I suggest you do not use them for your intended purpose.

    Read this before deciding on autonumbers.

  5. #5
    shockerty is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Aug 2014
    Posts
    4
    The autonumber would just be used as the primary key in the Delivery table as it could be the only unique value in a record on a specific day. The end user would not need to know about that as the unique 8 digit reference number would be the identifier in their experience. But unless I can somehow generate that number within the table I assume the autonumber is the best primary key for the table.

    I only created the DeliveryNumber query to generate the 6 digit "date code". It may be I have gone down the wrong track by doing so.

    The purpose of the database is to keep a record of everything we have delivered so that for example:
    -We want to see all deliveries that came in on ##/##/##
    -We have a delivery number ######## and want to know when it arrived and what it contained
    -etc

    There will also be a table DeliveryItems that will have a lookup column to select the primary key from Delivery, and contain information such as part number, description and quantity. This way one delivery can contain many different items, or just one.

  6. #6
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,640
    A unique identifier meaningful to users would be something like SSN, OrderNumber, InvoiceNumber. The autonumber could be made to look like a fixed length Order or Invoice number but if no gaps in sequence is important, that would not serve. Also, there is no guarantee autonumber will increment up or even be a positive, although I have never seen anything put positive incrementing. Generating custom unique identifiers is a common topic. Here is one for starters
    https://www.accessforums.net/access/...ers-21361.html
    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.

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

Similar Threads

  1. Replies: 7
    Last Post: 02-25-2014, 03:11 PM
  2. Replies: 4
    Last Post: 07-27-2011, 12:42 PM
  3. Setting Reference Number for records
    By ankash in forum Programming
    Replies: 1
    Last Post: 07-12-2011, 06:12 AM
  4. Auto generate reference number
    By JonB1 in forum Import/Export Data
    Replies: 1
    Last Post: 02-19-2011, 06:38 AM
  5. Correspondence Reference Number Generation
    By ildanach in forum Forms
    Replies: 1
    Last Post: 04-28-2009, 12:09 PM

Tags for this Thread

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