Jump to content
Sign in to follow this  
Vince Ada

Counter starts 001 when reaches 1000 returns 001

Recommended Posts

I am keeping my test simple. Just use a text box with no special formating and its only goal is to start counting at 001 to 1000 ( This number should change with every new record that is made). But when it reaches 1000 it starts over the counting with 001. I have tried many methods and failed I will try what ever anyone comes up with.

Vince

Share this post


Link to post
Share on other sites

Case( counter = 999, "1" ) & Right( "00" & NumToText(counter + 1), 3 )

Use it either in a Set Field when a new record is created or as an auto-enter calculation. Make counter a field in a preferences file which contains only one record and relate any files that require access to the counter using a constant calculation (or auto-enter) of 1.

Share this post


Link to post
Share on other sites

Hmm. I read this as wanting 001 to 1000, then 001 again.

Otherwise you need to account for adding 2 so that 999 will go to 1001.

Right( "00" & NumToText(counter + 1 + (counter = 999)), 3 )

Share this post


Link to post
Share on other sites

If you want 1000 to return 1, then the logic would be that a counter of 1 returns 2 I'd think.

Then Right("00"&(Mod(1+number,1000)),3) should do it.

You may explain the exact purpose of this though.

Share this post


Link to post
Share on other sites

That still returns '000' instead of '001'.

Share this post


Link to post
Share on other sites

That removes the leading zeroes and gives the wrong number. Keep going. wink.gif

Share this post


Link to post
Share on other sites

You need to NumToText it and then it should work. Seems a bit more complicated than mine though. wink.gif

Oh, and you need to add 1 to the number so it will increment.

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.