By Edit Copy and Paste i can copy a table,select the option "Structure only and paste it".In this case the Autonumber begins from 1.is it possible to do it by code ?
As far as I can see, if you use the CopyObject method, it copies the table structure and data. You would then need to delete the data in the new table. But when you delete the data, the autonumber is not reset to 1. To have it reset to 1, you can do a compact and repair on the database.
This can be in a macro:
CopyObject Action with appropriate paramters
RunQuery which would be a delete query on the new table
Then runcode which you can find at
Compact and Repair automatically at the start of each day
faq705-4998
My initial post is shy of what you need. The closet I find in my library is the [blue]TransferDatabase[/blue] method. With it you can [blue]export structure only[/blue] to another DB then import the table. The only problem here is the requirement of an additional DB resource.
There are other avenues such as using a Make Table query. But much more code/SQL is required.
you are correct as always, but in same cases you just need the fields (names and data types) to store the records, do stuff and when done move them back to original place.
But the Autonumber it does work, doesn 't it?
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.