Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

resetting Autoincrementing field for a new year 1

Status
Not open for further replies.

kstart

Programmer
Dec 25, 2004
21
US
I am experimenting with an autoincrement field instead of the "nextid" method. I can figure out how to make the prefix number of 2004 indicating records for this year. This is esay to roll over to 2005 but how do I start over at 0001 in the autoincriment field? VFP8 is the version I am using.
 
Yes but can you programmatically reset this at the new year 01-01-2005 0001 hrs?
 
Kestart,

You can certainly reset the autoinc value at the start of year. You need to use the ALTER TABLE command with a AUTOINC [NEXTVALUE NextValue [STEP StepValue]] clause.

But there is no way of putting dashes in the field. In VFP, the autoinc field is always an integer, not a character string.

Mike


__________________________________
Mike Lewis (Edinburgh, Scotland)

My sites:
Visual FoxPro (www.ml-consult.demon.co.uk)
Crystal Reports (www.ml-consult.com)
 
Thanks Mike. Or would you use the "nextid" method like I have in the past and just cause it to restart using the system clock as a trigger when it turns over to the new year. I cant tell which is easier now. But thanks very much.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top