How to create an Autonumber field in an Access query?

  • Thread starter Thread starter Paul
  • Start date Start date
P

Paul

I need to create an Autonumber firld in a query. The query is based on two
tables and primary key (autonumber) is existed on both tables. I do not want
the primary key from neither of the table and I want to create a new
Autonumber ID field starting from 1 for the resultset of this query. This
query will then be used for a make-table query and this new Autonumber field
will be used to form part of the content on another field and the Autonumber
field itself will become the primary key of this new table. Thanks.
 
There's no way that I'm aware of to do this in a query.

You could create the table, with an Autonumber field in it, first, then
insert your data into it. As long as you leave the Autonumber field out of
the list of fields being inserted into, Access will generate the numbers for
you.
 
Paul,
Not sure why you're doing all that, but...
Rather than just a normal query, try an Append query, where all the field
definitions are waiting in an empty table... including the AutoNumber field.
You would delete all the records, compact the database to reset the
Autonumber counter in that table, and then Append/Populate the table with
the records from your query.
Should fly...
 
Back
Top