Primary Key Help

A

Ayo

I need to find a way to auto-populate my primary key field based on another
field and a number, that is the maximum number available. For instance, let
say I have these fields:

G0023 UOGMDAENJA005 MDAENJA005 GSM850
G0024 UOGMDAENJA019 MDAENJA019 GSM850
G0306 UOG551G3811 551G3811 GSM1900
G0307 UOG551G3829 551G3829 GSM1900
U0026 UOGMDAENJA024 MDAENJA024 UMTS850
U0027 UOGMDAENJA025 MDAENJA025 UMTS850
U0028 UOGMDAENJA094 MDAENJA094 UMTS1900
U0029 UOGMDAENJA096 MDAENJA096 UMTS1900

The first column is my primary key with which is based on my last column "G"
or "U" and a number. So, let say I entered another site ID (column 3) I would
want my index to be "G0308" or U0030" depending on what I have in column 4.
 
J

Jeff Boyce

This may be a "semantic" issue...

If you are talking about Access' Autonumber field type, you will NOT be able
to tell it what to hold ... it's an auto-number, done by Access.

Philosophically, there's rarely a good reason for duplicating data you
already have to construct another field that would be your primary key
field.

Have you considered using multiple columns which, taken together, represent
your primary key? You can do that with an Access primary key field(s).

What will having this particular "other field and a number" as a primary key
allow you to do?

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
A

Ayo

"using multiple columns which, taken together, represent
your primary key? You can do that with an Access primary key field(s)."

How will this work? This might be what I need.
 
J

Jeff Boyce

Open the table in design view.

Highlight the field(s) you want as primary key. Right-click and select the
"key" symbol.

You now have a multi-column primary key.

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
A

Ayo

Thanks so much Jeff.

Jeff Boyce said:
Open the table in design view.

Highlight the field(s) you want as primary key. Right-click and select the
"key" symbol.

You now have a multi-column primary key.

Regards

Jeff Boyce
Microsoft Office/Access MVP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

No Primary Key! 4
IE6 Hacked! Help! 3
Primary Key new field 2
IE Hack in Windows 2000 1
Very urgent for autoincriment primary key 17
Primary Key Index 2
Adding a primary key 3
Update primary Key. 1

Top