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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Primary Key

Status
Not open for further replies.

Will8342

Technical User
Oct 25, 2002
4
US
It's been a year since I've worked with Access and I am now building a database for a financial company. I have the design and format all set up, but i forgot the controls and data type format for a primary key that is a letter-number combination (ie T001). Thanks in advance!
 
[tt]The primary key data type can be anything you want it to be, it's the entries that really make it a primary key because it can not accept duplicate values.

Make it a text field if you want.

<%=Tony%>
banana.gif
rockband.gif
banana.gif
 
[tt]I would make it an autonumber that way you're sure there won't be duplicates.

<%=Tony%>
banana.gif
rockband.gif
banana.gif
 
Thanks for your input. However, let me restate my question. What I am trying to do is have forms that input the data into the tables (obviously). So, on the form, I want the ID to fill in automatically with a logical progression from the previous given key. For example, I have a Customer Table. I want the first Customer to be C001, the second Customer to be C002, so on and so forth. I need this to fill in automatically on the form. I need a key that is used for relational purposes and not necessarily relevant to the customer itself. Thanks again!
 
[tt]Ah ok, then I would not the right person to answer your question since I only work with databases thru ASP.

I'm sure there's a VBA way to do what you're looking for.
Thanks

<%=Tony%>
banana.gif
rockband.gif
banana.gif
 
What happens when you get your 1,000th customer? Gotta rewrite your database. Bummer.

=============
Jeremy Wallace
Designing, Developing, and Deploying Access Databases Since 1995

Take a look at the Developer's section of the site for some helpful fundamentals.


Remember to reward helpful tips with the stars they deserve.
 
Thanks for the input there Jeremy. You're insight is nice yet quite the norm. I used an example as T001, not an absolute. I'm trying to find a way where the primary key is an auto number in the sense that a user cannot pick the key and it automatically is filled in on the form, but also has a qualitative characteristic to help identify the key when placed as a foriegn key in another table.
 
Will,

&quot;quite the norm&quot; implies you've seen this advice before. If so, I would assume you've also seen people writing that there are plenty of ways to generate primary keys that are not autonumbers, and that have whatever characteristics you want. If you've seen people writing about those solutions, I'll assume you can implement them, as they're quite simple.

I'm just not sure why you bothered to post your question, if you know the answer.

Jeremy =============
Jeremy Wallace
Designing, Developing, and Deploying Access Databases Since 1995

Take a look at the Developer's section of the site for some helpful fundamentals.


Remember to reward helpful tips with the stars they deserve.
 
&quot;quite the norm&quot; was refering to if one has only 3 available digits, 4 digit material won't fit. Like I said in my first post, it's been about a year since I've worked with Access and I wanted a quick reminder instead of looking through my notes and books. However, since you (Jeremy) could not resond to the actual question, but chose to reply to the example set forth, I reverted to plan B and looked it up. Thanks to those who had input! :)
 
Do I detect a Willi with a strop on ?


;-)



G LS
accessaceNOJUNK@valleyalley.co.uk
Remove the NOJUNK to use.

Please remember to give helpful posts the stars they deserve!
This makes the post more visible to others in need! :-D

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top