Gerard,
Since it looks like you're using SQL Server, I'd use a Stored Proc to handle the stuff with the Numbers table and return the next available number.
~~Bonnie
>Hi.
>I have a form (Windows C#) which has a no. of fields on it, one field (Dept)which will be used as a key into a Numbers file, to assign next available sequential number for the particular department.
>I also have a numbers file with just two fields:
>Dept
>PrevNum
>..use to hold Prev sequential number for each department
>
>
>What I want to do is:
>Do a lookup on the Numbers File using the Dept as a Key
>If it exists, add 1 to PrevNum, replace it and use this as the next number
>If it does not exist, append record to Numbers file and move 1 into it
>
>I could do this in a few mins in VFP but would appeciate some assistance in the C #/ Sql code required here.
>
>(I have a Save Transaction button on the screen which does all the saving to the main transaction file using an Sqladapter)
>
>Thanks in advance
>Regards,
>Gerard