tags:

views:

736

answers:

2

How to create Auto Number Field in access?

Create table table1 (RecordNo autonumber, personid varchar(50)…)

But it showing error.

How can I make a query in the access?

+2  A: 

According to SQL Auto Increment a Field:

CREATE TABLE Persons
(
P_Id PRIMARY KEY AUTOINCREMENT,
LastName varchar(255) NOT NULL,
FirstName varchar(255),
Address varchar(255),
City varchar(255)
)

The MS Access uses the AUTOINCREMENT keyword to perform an auto-increment feature.

By default, the starting value for AUTOINCREMENT is 1, and it will increment by 1 for each new record.

To specify that the "P_Id" column should start at value 10 and increment by 5, change the autoincrement to AUTOINCREMENT(10,5).

eed3si9n
A: 

Method 1:

  1. Open table in design view
  2. Make a field named "ID" or whatever the field will be that will have the Auto Increment
  3. Put "AutoNumber" under DataType

Method 2:

  1. Make a new table
  2. Close the table and save it
  3. When it asks if you want a primary key click ok
  4. Open the table in Design View
  5. Edit the new field to whatever name you like