PDA

View Full Version : Is it possible to create an ID number on a form generated from a table?



wedd
10-04-2011, 02:54 AM
I created a form from a table in access 2010 as well as added some vba functioning buttons, however my customer ID number in the table which is a primary key, doesn't appear on the form...and displays a message that customerid shouldn't contain a null value in an index or primary key field...I created a self made ID numbers based on company names and customer names as text in the table...however I would like to automatically create a customerID number based on the customer's with the first 6 letters of their customer name. That will automaticaally generate when I add new customers. The customer name comprises of both the customers first and last names...is this possible to do, if so how can this be done?


Thanks for your contributions:friends:

HiTechCoach
10-05-2011, 07:40 AM
What you are wanting to do is possible but proably shoudl not be done for many reasons.

What you are descibing violates the rules of data normalization by storing a calculated value based on other fields in the same record. This shoudl be avoided.

I would highly recommnd using a primary key that is not calcualted based on data that can change. In Access this is best done with an auto number data type field.

TIP: Computers store and process numeric data more effiently than text. Another good reason to use an auto number data type as the primary key.