D2 - Paradox 7 - BDE 4.51 - Key Violation

I encountered a key violation error when trying to post an inserted
record into a table with an AutoInc field.
I was able to fix this by using Database Desktop to restructure the
table and changing my ID (Primary Key/Autoinc) to an integer, saving the
table, then changing the field back to an AutoInc.
As I'm wary of this happening again, Id really appreciate any code
samples of how to make this change programmatically (or alternatively
suggestions on how to prevent this occuring and fixing it if it does).
If possible could you reply to both the NG and e-mail, as I may not have
access to the NG over the next few days.
TIA, David Carle