primary key appending

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

Forum home » Delegate support and help forum » Microsoft Access Training and help » Primary key - Appending and auto number to a set prefix

Primary key - Appending and auto number to a set prefix

resolvedResolved · Low Priority · Version 2003

Nam has attended:
Access Introduction course
Access Intermediate course
Access VBA course
Access Advanced course

Primary key - Appending and auto number to a set prefix

I have got 2 tables, tblClient and tblInvoicing on a one to many relationship respectively. How do I number my Invoice numbers (Primary ID field) such that they contain a prefix "PREM" then auto number of 6 fields e.g. PREM000001 for the first invoice number, PREM000010 for the tenth. How do I get the 4 letter prefix depending on the client e.g "PREM" for Premier, "CAST" for castlefield.

Edited on Mon 7 Apr 2008, 22:06

RE: Primary key - Appending and auto number to a set prefix

Hi Nam, Thank you for the post, welcome to the forum, in answer to your question, try this, create your database or amend your existing database, in the ID field which I assume you have as an Autonumber field, (remember you can only link an autonumber to a Double Integer field), in the Table design view, select the ID field and in the Format line of the field properties enter the following for your Premier Table.

"PREM"000000

With the zeros being the number of numbers you require, for your other table obviously substitute the PREM with CAST,

I hope that works, it usually does, if so, please click the Resolved link, best regards Pete


 

Access tip:

Creating Parameter wildcard queries

To creat a parameter query that also uses a wildcard, in the query design type in like []+*.

View all Access hints and tips


Server loaded in 0.08 secs.