Solved Add Index Field? (1 Viewer)

Space Cowboy

Member
Local time
Today, 14:05
Joined
May 19, 2024
Messages
151
Good Afternoon Good People,

I have converted a query to a table.
I need to add a unique ID to each row
Is there a simple way to add an auto number index field, I thought that it may ask me on creation but it did not.
 

GPGeorge

George Hepworth
Local time
Today, 06:05
Joined
Nov 25, 2004
Messages
2,158
Queries don't have independent indexes. Tell us what you are really aiming for as the final product. June7's suggestion, for example, would work if the table in the query actually includes an AutoNumber in it.
 

Space Cowboy

Member
Local time
Today, 14:05
Joined
May 19, 2024
Messages
151
I currently have the following Table

PrtIDodateOrderID

Several different parts can be on an order. For other calculations I need a unique ID for each row. The first column needs to be supplemented to the above table to produce the below table. I would like it to auto number the entire table.

IndexIDPrtIDodateOrderID
 

June7

AWF VIP
Local time
Today, 05:05
Joined
Mar 9, 2014
Messages
5,525
See my previous (edited) reply.

ALTER TABLE tablename ADD COLUMN IndexID COUNTER, CONSTRAINT PRIMARYKEY PRIMARY KEY (IndexID);

Field will be added at the end of fields in table design.
 

Space Cowboy

Member
Local time
Today, 14:05
Joined
May 19, 2024
Messages
151
I have added a new field as instructed and set data type as auto number.

Get this

CaptureA.PNG
 

Space Cowboy

Member
Local time
Today, 14:05
Joined
May 19, 2024
Messages
151
I have reduced the rows to half a million and auto number has worked. Thanks June7

I will just push until I find the max.

Thank you all!
 

isladogs

MVP / VIP
Local time
Today, 14:05
Joined
Jan 14, 2017
Messages
18,330
I had a CSV file of 2.6 million postcode records and over 50 fields which I imported into Access and added an autonumber PK field.
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 09:05
Joined
Feb 19, 2002
Messages
43,980
I have reduced the rows to half a million and auto number has worked. Thanks June7
So, with something that large, the best solution is to define the table with an autonumber column as the PK and then run an append query. You shouldn't have any trouble generating an autonumber this way.
 

isladogs

MVP / VIP
Local time
Today, 14:05
Joined
Jan 14, 2017
Messages
18,330
So, with something that large, the best solution is to define the table with an autonumber column as the PK and then run an append query. You shouldn't have any trouble generating an autonumber this way.
It was slightly complicated in my case as that single table occupied almost 1.6 GB! Thankfully the data was read only
 

Users who are viewing this thread

Top Bottom