Okay I chatted with him and this is what happens: when I call the stored procedure, it takes in the current user and the current year. The lock is the user name - if the lock is free then it sets the lock to the user name, if another form calls the procedure, it sees that the lock is set to another user, so it waits until it is free. The other form will release the lock when its done and exits. It resets on the new year via the passed in year. the table value has the counter and the year. it checks to see if the year passed in matches any years in the table, if it does then it increments the next number. if its a new year, it sees that there are no entries for the year so it starts at 1. It's a very simple, rudimentary solution but it works for us and you don't have to deal with sharepoint library permissions, we just use a sharepoint SQL server user that has access to the appropriate tables and use that user in the connection string.