tacieslik
01-14-2002, 09:15 AM
Is there a way to set the AutoNumber of a field in a form back to zero when all the records in a form are deleted. I have a subform which uses the AutoNumber function, but when I delete records, the AutoNumber continues from the last number it got to?
boblarson
01-14-2002, 10:22 AM
The only way that I know of is to run the Compact operation first before adding new records to the blank table. I do this via code for several databases that need this ability too.
I use Sendkeys to make it work. The code is:
Sendkeys "%(TDC)", False
I use it from a tabbed control on a form and since it doesn't like to do the SendKeys correctly with a tabbed control there, I just created a blank form which is made small and then I put the above code in the On Open event of the blank form. Works like a charm.
BL
hth
[This message has been edited by boblarson (edited 01-14-2002).]