If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Field format
I need to have a project number that forces ensures that the field has 5
parts: 1. Always the letter C 2. Last two years of Year 3. 3 digit number (sequential) 4. "-" 5.2 digit sequential (usually just 00) So the first Project in 2010 will be : C10000-00, 2nd will be C10001-00, 3rd C10002-00 and so on How do I enforce this in the field - both in the table and in the form... Thanks! -- Message posted via http://www.accessmonster.com |
#2
|
|||
|
|||
Field format
On Wed, 17 Feb 2010 17:15:42 GMT, "szag via AccessMonster.com" u2885@uwe
wrote: I need to have a project number that forces ensures that the field has 5 parts: 1. Always the letter C 2. Last two years of Year 3. 3 digit number (sequential) 4. "-" 5.2 digit sequential (usually just 00) So the first Project in 2010 will be : C10000-00, 2nd will be C10001-00, 3rd C10002-00 and so on How do I enforce this in the field - both in the table and in the form... Thanks! This is called an "Intelligent Key" - and that is unfortunately not a compliment! Two basic principles of relational database design are that fields should be "atomic" - containing only one fact; and that no field should depend on any other field (except for the primary key). This field violates both. Another good rule is that you shouldn't store repeated data - the C and the - are there in every record, just wasting space. I would really construct this project number as needed from multiple pieces. You could use a (concealed, hidden from the user) Autonumber as the project ID, and have fields for ProjectDate, SeqNo, and SecondarySeqNo, with a unique index on the three fields; you can construct your project number by concatenating the pieces: ProjectNo: "C" & Format([ProjectYear], "yy") & Format(SeqNo, "000") & Format([SecondarySeqNo], "\-00") -- John W. Vinson [MVP] |
Thread Tools | |
Display Modes | |
|
|