Jump to content
Sign in to follow this  

Resetting serial number

Recommended Posts


I have a simple, (for everyone else), but painful (for me) task. As of now, we have our users go to a 3-ring binder behind the front desk to get the information that follows:

When they require the next Invoice number to use, they go to this book, get the number(They are sequential), fill in the "Issued to",

"Job #", and "Date". That's is ALL that this book is used for. They are not invoicing out of it or anything, that is done separately by the Accounting department and application that we use.

Here is where it gets tricky for me. At the beginning of every fiscal year, which is October 1, the Invoice numbers start over, with a new prefix. This allows us to track how many invoices are sent out for that particular year. As of now, we are on Invoice # 07-164, and October 1, the next invoice will be 08-001.

Is there a simple way to do this? My file has 6 fields:

Invoice_Prefix - Right(Year(Get( CurrentDate));2)

Invoice_Number - Invoice_Prefix &"-" & Serial Number




Serial Number - Auto enter serial number.

The prefix symbolizes the year, 07, 08, etc... and the Invoice Number is the sequential field that starts back at 001 at the beginning of the fiscal year. If more information is needed, just ask. I know it's a simple fix on the code, but I'm struggling with it. Too long of a week.

What I have so far works great, but I can't get it to reset the serial number back to 001 on October 1 when our fiscal year changes. Any thoughts or suggestions?

Thanks in advance!

Don Mayes


Share this post

Link to post
Share on other sites

Hi take a look at the links on this thread.

Resetting Serial Numbers

Pay attention to the warnings in all the links.

Also, you may want to change your profile to reflect your curent version of FM. It still says FM6 in your profile. You can change this by going to 'FileMaker Questions' under Your Control Panel, which is located under the My Profile button.

Share this post

Link to post
Share on other sites


I printed them out and read through them, even downloaded the files attached. I see how it's similar to my issue, but I'm not very proficient at the coding aspect and am having trouble with manipulating them to fit me. Is there an easy way to take out year aspect, and insert I guess some code to test for October 20th, and have that switch over. I apologize for the lack of brain waves, but I am trying to learn. Although I did get my profile changed. Thanks!


Share this post

Link to post
Share on other sites

Ok Vodka, I have been trying to decipher this code, and I need some help understanding what it's exactly doing. I see the results, and the code, but I can't put them together. It's the AnnualSerial Custom Function code:


year = Year ( Get ( CurrentDate ) );

lastId =GetNthRecord (AEfield ; Get ( TotalRecordCount ) - 1);

lastYear = Left ( lastId; 4 )





year ≠ lastYear or Right ( lastId ; digit ) = 10^digit -1; Right ( 10^digit ; digit-1 ) & "1";

SerialIncrement ( Right ( lastId ; digit ) ; 1 )



Like, I'm not sure why the Power operator is needed and what it's doing, things like that. Help please. lol....


Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  


Important Information

By using this site, you agree to our Terms of Use.