On Sat, 02 Oct 2004 13:12:02 GMT, "Danny" <da********@hotmail.com>
wrote:
I have a db that has a table that is never deleted but just has records
cleaned out
"delete * from table"
but each time it is populated, the autonumber is not reset to 0 and picks up
where it left off even though I delete the records.
Is there a way in code i can compact the database (I know this is the way to
reset that blank tables autonumber to 0). I know I can compacdt on exit but
the table will always be populated at this point and must stay that way for
the user puprposes.
Thanks in advance
A few thoughts on this ...
First: Why do you care what the autonumbers are? It is considered best
not to rely on them for any user information - they are there only for
PKs and relationships.
Second: Is the database split? (it really should be) If so then you
could close all connected objects (forms, reports and queries) and
Name it to a different location and then Compact it back to the
original location. e.g.
Dim strPathSrce As String
Dim strPathDest As String
strPathSrce = 'where the backend data is now
strPathDest = 'a temporary location (or backup location)
'Move file to destination
Name strPathSrce As strPathDest
DoEvents
'Compact it back to the original source
DBEngine.CompactDatabase strPathDest, strPathSrce
Third: In Code create a temporary database to hold the temporary table
whenever you need it. No need to compact just destroy and recreate the
temporary database (and table) as needed. Leave the link alone.
- Jim