Public Schedule Face-to-Face & Online Instructor-Led Training - View dates & book

primary key

ResolvedVersion 2003

Beverley has attended:
Excel Advanced course
Access Introduction course
Access Intermediate course
Excel VBA Intro Intermediate course

Primary Key

If i want to set the Primary Key as a school identifying number ie SCH1 can i get acccess to copy that format but changing the number down the list to show SCH2, SCH3 etc or do i have to do each entry manually?

RE: Primary Key

Hi Beverley

The answer is yes......

Create a new column and call it SchoolID for example.
Set the data type of SchoolID field to an Autonumber.
Move down into the field properties of that field and add the following code to the Format property: "SCH"&

When you add a record in datasheet view this column will be completed for you by Access. SCH1
The next record will be SCH2 etc....

Best wishes,
Tanya

RE: Primary Key

HI I have done this and it works find down to SCH9 and then it goes to 1SCH0, is there anyway to change this to say SCH10?

Many thanks

RE: Primary Key

Hi Beverley

Try replacing the code I gave you with the following code
"SCH"0.
Put this in the format property of the SchoolID field. I tested this and it works with SCH10 etc

Tanya

Tue 25 May 2010: Automatically marked as resolved.

Access tip:

Compact database automoatically

To ensure optimal performance, you should compact and repair your

Open the Access database or Access project that you want Access to compact automatically.
On the Tools menu, click Options.
Click the General tab.
Select the Compact on Close check box.

View all Access hints and tips

Connect with us:

0207 987 3777

Call for assistance

Request Callback

We will call you back

Server loaded in 0.11 secs.