primary key
The UK's Number 1 for Microsoft Office Training Add this page to your favourites/bookmarksBookmark page
 
View printable version of pagePrintable version
Plus One Google
Customer: Sign in
Delegate: Sign in
Trainer: Log in

Forum home » Delegate support and help forum » Microsoft Access Training and help » Primary Key

Primary Key

resolvedResolved · Low Priority · Version 2003

replyReply Mon 17 May 2010, 14:32Delegate Beverley said...

Beverley has attended:
Excel Advanced course
Access Introduction course
Access 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?

For upcoming training course dates see: Pricing & availability

replyReply Mon 17 May 2010, 16:59Trainer Tanya said...

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

replyReply Tue 18 May 2010, 09:13Delegate Beverley said...

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

replyReply Tue 18 May 2010, 22:15Trainer Tanya said...

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.

 

Please browse our web site to find out more about
access class ms training and other Microsoft training courses.

Access tip:

Change case

To change case from upper or lower case, highlight the text area, hold down the Shift key and pres F3

View all Access hints and tips


Microsoft Certified Partner Accredited Training Provider: Institute of IT Training Institute of Leadership and Management - Certified Courses Security Seal verified by visa, mastercard securecard