Results 1 to 4 of 4
  1. #1
    Join Date
    Apr 2013

    Unanswered: Display Today's Date plus increment

    Hello. I was wondering how to display today's date plus an incrementing number in a table in Access 2007. Basically, we want to have each new record's primary key to be this --> Today's Date+001, 002, 003 etc as each new record is entered. So record one would be 0415001, two would be 0415002 etc. I hope I have explained it well enough. Thanks for the help.

  2. #2
    Join Date
    Feb 2004
    New Zealand
    Provided Answers: 10
    What i would do have a pk (name it the table name +id) that increment up but its a hidden from the user then when a new record added do a count on the date feild to find out what number it is.

    The reason for the pk just been a number only its easer to link that to a fk in a differance table.
    hope this help

    See clear as mud

    StePhan McKillen
    the aim is store once, not store multiple times
    Remember... Optimize 'til you die!
    Progaming environment:
    Access based on my own environment: DAO3.6/A97/A2000/A2003/A2007/A2010
    VB based on my own environment: vb6 sp5
    ASP based on my own environment: 5.6
    VB-NET based on my own environment started 2007
    SQL-2005 based on my own environment started 2008

  3. #3
    Join Date
    Apr 2013
    Okay, so after some research I decided to go a different route. What I would like to do is have the field autofill using a combo of the days date plus an auto incrementing number so when a new record is entered it gets the autofilled number. How can I do this?

  4. #4
    Join Date
    Nov 2004
    out on a limb
    Provided Answers: 59
    create a function which returns the next available number for this row
    using the DMAX function
    if its a multi user app then you need to work out how you will handle possible clashes where two or more people are trying to add a new record at the same time. one technique woudl be to capture the data, then possibly write a row with a gash number, then seek to get a lock on the table get the new number, update the new record with the correct new number then release the lock
    ...of just go for it, and error trap if there is a duplicate valeu then call the function again and again until the error isn't repeated
    I'd rather be riding on the Tiger 800 or the Norton

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts