FA wrote in message
You suggestion is 100% right Roy and i really appreciated that you took
your time to respond to me.
Field Name: FINDG_NO
Table Name: FINDG
Yes it is a primary key
Now the user do not want to enter the finding number manually. instead
they have standardized the finding number with System Code and
TestBeginDate and 001 for the first finding 002 for the second.
Each SystemCode would be unique and coming from table SYS_INFO that has
a one to many relationship with table FINDG.
I initially put this as a autonumber but the project managers want the
Finding Number to be composite of SYS_CODE and TestBeginDate (these two
fields are in Table SYS_INFO).
So i am taking these two fields from that table concetenating them and
saving them in FINDG_NO in table FINDG. Each FINDG_NO would be unique
since i will have 001, 002,003 at the end of each FINDG_NO.
Each SYS_CODE can have many FINDG_NO but SYS_CODE and Testbegindate
will remain the same only it will have different autonumbers at the
end.
I tried to convence my managers not to do it this way but they want to
have the FINDG_NO automated.
Is there anyother way beside concetenating those two fields and having
the autonumber at the end for each FINDG_NO??
If so please let me know because i am pulling my hairs at this point
;-((
Thanks Millions
Moe
There is a mixup of terms here - composite - vs concatenated
Composite primary keys are a quite ordinary part of ordinary database
work - except if you're a complete surrogate key fan(atic) - but lot
of surrogate key fans, would not mind using composite primary keys
for instance in junction tables. But it is important to note that a
composite primary key consists of the actual fields, not a concatenated
mess. Again - a composite primary key is not a single field
concatenated
mess it is a primary key consisting of the original fields!
Fields that are concatenated from other fields are a complete no-no in
relational databases. If you have any control over the process at all
you simply don't do that, but concatenate whenever there's a need to
display it.
How to calculate the number, I do not know, if it should just start
from
1, why not just use an autonumber (and if so, why couldn't that be
used as primary key)? I'm sure there are lot of "Autonumber" code
solutions to be found through a search here.
So if this can be solved by autonumber, make the FINDG_NO field an
autonumber field, and stop this concatenation! Make a composite (not
concatenated primary key out of FINDG_NO, TestBeginDate and SYS_CODE -
but use those fields, not any concatenation scheme ...
- he he - you could have your managers read this, and see if it
helps;-)
Or check out NG's dedicated such issues, like for instance
microsoft.public.access.tablesdbdesign