>Craig,
>This is the first Stored Procedure i've used. I've created a Primary key index in my database called "nextid". In the default, I put Getkey("MyTableName"), then I cut and pasted the code from your site. I'm not really clear on what a lot of the lines of this code does, so I really don't know what to change. Could you summarize it for me?
Make the DEFAULT value of the field the same as for the PK in my example. If the user cancels, you'll never get the number. You can think of stored procedures as a big PROCEDURE file that is always available to the data.
>
>
>>>I need to write a little code that generates a number that equals the last number plus one each time a new record is appended, and writes it to a field in that record when the save button is pressed. It should cancel the number if an exit w/out save is executed.
>>>
>>>An extra would be that I want to make it start back at zero at the beginning of the year.
>>>
>>>If someone could give me some code, a hint, or just point me in the right direction, I would really be endebted.
>>>
>>>Thanks ahead of time,
>>>Jimmy Ditta
>>
>>Jimmy,
>>
>>There is a Primary Keys KB article on my web site, complete with code, that will do this for you.
Craig Berntson
MCSD, Microsoft .Net MVP, Grape City Community Influencer