I have a Maketable query in an Access db that could use an Autonumber field. I can't find a built-in function for my purpose. Do i need to write my own? Ideally, I'd just like to create a field in the Access designer as "Autonum: CreateAutoNumber()"
Edit: If it can't be done in the query itself, I can also run a procedure afterward.
I reckon you either need to use TableDefs or DDL. The DDL query would run after the maketable query, for example:
 ALTER TABLE NewTable ADD COLUMN AutoField COUNTER
EDIT Additional note
If you wish to make the new column the primary key, you can run something like:
ALTER TABLE NewTable ADD PRIMARY KEY (AutoField)
make your life simple, create a delete query followed by an append query, then use a macro to run them. if you need the autonumbering to start from 1 every time, create another query from your table with an extra column with the following code idnew:dcount("[id]","mytable","[id]<"&[id]) hope this helps.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With