- Local time
- Today, 18:06
- Joined
- Feb 19, 2002
- Messages
- 43,266
Autonumbers are simple sequential or randomly generated numbers intended to be used as unique identifiers. It is confusing to use "ID" as the suffix to anything other than an autonumber. YOU can of course name your fields anything you want. However standards help you and others to identify and understand relationships. If the PK of a table is an autonumber that's fine. If you have an additional unique identifier that is a custom-generated string, that's fine. HOWEVER, the custom string is NOT stored in multiple places. It exists ONLY in the one table where it defines a record and it must also have a unique index to ensure there are no duplicates. In the second table, the FK points to the autonumber NOT to the custom-sequence number.
And NO, an autonumber cannot be used as you want. If you want a custom prefix, you must generate the code yourself. Here's a sample database that shows an example. Remember, these custom identifiers are just that - CUSTOM. So, don't expect the example to be exactly what you need. It shows the concept of concatenating a generated sequence number with other fields to make a unique code.
And NO, an autonumber cannot be used as you want. If you want a custom prefix, you must generate the code yourself. Here's a sample database that shows an example. Remember, these custom identifiers are just that - CUSTOM. So, don't expect the example to be exactly what you need. It shows the concept of concatenating a generated sequence number with other fields to make a unique code.