>>Normal ID generation procedure (can be stored or regular) is foolowing:
>>You have separate table 'Setup.dbf' with two fields 'Tablename','NewID'.
>>***Procedure GetNewid
>[...]
>
>Right, thanks. This way the only way to retrieve the new index to show it on my form (without requerying the table), would be to call GetNewId as a regular procedure, maybe just before the TableUpdate(). But what should I do if the update fails for whatever reason ? I'd like to avoid 'holes' in the ID field, and so the stored procedure should be preferred. But then, how could I get the new id back to my code ?
Well, this stuff depends on the approach you apply when you save a new record. My preference is to generate NewId after all validations made, i.e. the only chance that INSERT will fail is network hardware problem, i.e. normally it will go Ok 99%, and some 'holes' is not a problem as long as database uses surrogate primary/foreign keys.
PS. When you 'RETURN nNewid', it means that you get it back to your code.
Edward Pikman
Independent Consultant