Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need help to increment a composite primary

Status
Not open for further replies.

rprieto

Technical User
May 21, 2003
10
US
I need help in creating an autonumber like field.
Program_Name and Prg_Rec_No are composite primary keys.

Originally Prg_Rec_No was an autonumber field type and this was OK when the database was used for only one Program. Now it is to be used for multiple programs.

How can I auto-increment the Prg_Rec_No field for each new or additional Program_Name? See sample below.

Program_Name Prg_Rec_No
Program A 1
Program A 2
Program B 1
Program C 1
Program C 2
Program C 3

What I hope to do is this. Upon entering data for a new Program_Name, say "Program D", I would like Access to recognize there are no pre-existing records of "Program D" and automatically create a new Prg_Rec_No to be "1".

Also, I need Access to recognize upon entering a new record for Program B that the last known record # (Prg_Rec_No) is 1 thus assigning the "new" record Prg_Rec_No # to be "2" (for Program B) and so on.
 
Duplicate post. Please ignore. Posted in Access area.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top