Results 1 to 4 of 4

Thread: Autonumber field - restart each year

  1. #1
    Join Date
    Jan 2011
    Posts
    53

    Autonumber field - restart each year

    Hi, I have read each post I can find on this topic but I did not find any solution to my issue. I formed an access database (intended for volunteer work) that has an Autonumber field on the way to issue numbers to creatures taken in at our protection. My 'boss' (as well a volunteer) desires this easy Autonumber altered to a value that starts by the two figure year and after that has four digits, starting through 0001 that will increment in sequence and re-begin at 0001 through new calendar year. Thus, records will begin with 10-0001, 10-0002, and so on for this year as well as 11-0001, 11-0002 for after that year. Any help would be very much appreciated.

  2. #2
    Join Date
    May 2009
    Posts
    527

    Re: Autonumber field - restart each year

    There are two techniques to perform it, have an Autonumber Field as well as a Date field and merge them simple VBA to show the Number the manner which you would like. The only trouble by means of this technique is deleted or else cancelled records increase the Number, as a result you have gaps. The additional technique involves making use of a VBA recordset on the way to increment the value. I will recommend you to make use of the second technique.

  3. #3
    Join Date
    Jan 2011
    Posts
    53

    Re: Autonumber field - restart each year

    Thank you for your suggestion as you have mentioned I make use of the second technique, Got it to work and it told me to create another field which I did.On the other hand, I require to have this counter reset to one every year. Because the present code is working off the autonumber, I cannot reset it. Do I require to make one more numeric field plus have it increment every time the form is saved or else every time the triggering field through first data input on the has data enter similar to the code you mention at first? As I am not a VBA one I'm uncertain how to perform that. Thanks once more.

  4. #4
    Join Date
    Apr 2009
    Posts
    488

    Re: Autonumber field - restart each year

    It is not for the reason that you require a unique field it needs to be the primary key. The similar circumstances are present in invoice numbering, they need to be constantly numbered and re-begin by 1 every year. The most use solution for that is:the pk field, as usual, an autonumber that is unknown to the users. The unique number in this case, is generated automatically from the sysCounters table. Youcan use the following code for this purpose:

    IDCount (autonumber) = PK
    Typecount (number if you have a associated types table), you require only
    countYear ( this makes it likely at the
    beginning of a year to make a ticket for the most recent year, or else to make
    already a number for the next year at the end of a year)
    Valuecount: the last used number.

Similar Threads

  1. Replies: 7
    Last Post: 18-10-2011, 01:05 AM
  2. Fix a field on a LAN DNS
    By Remedy in forum Networking & Security
    Replies: 4
    Last Post: 26-12-2009, 03:01 PM
  3. How to write a program to determine if year is leap year or not
    By Luis-Fernando in forum Software Development
    Replies: 4
    Last Post: 30-11-2009, 05:21 PM
  4. Multi Field value field in Microsoft Access
    By Erubiel in forum Windows Software
    Replies: 3
    Last Post: 20-11-2009, 12:55 AM
  5. Everytime I Restart Windows XP PC Year Changes
    By Theodore in forum Operating Systems
    Replies: 4
    Last Post: 20-11-2008, 04:09 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,711,661,834.66000 seconds with 17 queries