Results 1 to 5 of 5
  1. #1
    Scofield67 is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    May 2014
    Posts
    2

    Automatically Change Number In Field

    Guys/Gals



    In a field called PSSheets I want the number to be update every new entry, if I use the AutoNumber feature it won't let me enter the number I want to start with, which is 1421001, then the next number would be 1421002 and so on right up to 1421200 and then the number would change to 1422001.

    14/21/001 relates to Year/Week/Entry.

    Can anyone assist?

    Thanks in advance to any replies.

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,646
    Generating custom unique identifier is common topic. I do something like what you describe. Review: https://www.accessforums.net/forms/a...ing-23329.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.

  3. #3
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,862
    You can start the autonumber at whatever number you want by using an append query.

    Create a copy of your original table, without data.

    Change Autonumber to Long Integer

    Type the number you want to use as a starting point in the new table you created.

    Run a compact and repair

    Append the record(s) in the new table to the original table.

    So long as the new number you typed is not being used in the original table and it is a larger number than any existing records, you are good to go. The only thing is, sometimes the Autonumber field may not give you true sequential numbering. If you can not have a missing number in your sequence, you need to consider another approach.

  4. #4
    Scofield67 is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    May 2014
    Posts
    2
    Fellas unless you can guide me through it I'm going to struggle. I am a complete Novice.

    Thanks though for your replies.

  5. #5
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,646
    What you want requires code. I referenced a link that offers an example. Adapt it to your database. In your case, you need to use date manipulation functions to pull the current year and week from the current date. The VBA procedure will pull up the latest ID, parse it to its component parts, compare to current year/week to determine if need to restart sequence or increment the sequence, then concatenate the sequence with the current year/week parts.
    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. number field automatically
    By azhar2006 in forum Forms
    Replies: 7
    Last Post: 01-29-2014, 03:14 PM
  2. Replies: 1
    Last Post: 10-16-2013, 09:41 AM
  3. Replies: 17
    Last Post: 12-20-2012, 07:56 AM
  4. Replies: 4
    Last Post: 04-18-2011, 07:18 AM
  5. Replies: 1
    Last Post: 01-26-2010, 10:36 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