Skip to content
Advertisement

Can you insert a custom value in an Auto-incrementing field in MS Access

The column auto-increments. User wants to insert a row with a specific number (I’ve confirmed it doesn’t already exist in the column). In SQL Server I’d do a quick SET IDENTITY_INSERT ON and insert statement. Is there a way to this for Microsoft Access or are they just out of luck.

Advertisement

Answer

Can run an INSERT action SQL.

But then need to Compact & Repair to reset the autonumber seed. Or, per @4dmonster comment, run another INSERT with the maximum autonumber value already in database. As long as the autonumber is set for unique index, the insert will fail but sequence will be fixed and normal data entry will generate next number. I tested and it worked.

I can only guess this autonumber is used as a sequential number that must be accounted for, as in a license number series. Otherwise, sequence gaps should not be a concern and can be ignored.

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement