Secret said:
Right now I'm using an AutoNumber as my return material authorization #'s.
Can I add a prefix to this number or is that not possible? I already have
about 300 records in my database so I would want to go back and have it add
this prefix to the existing records. There are 2 prefixes that I need to add.
First I need the letters "BC" and then the 2 digit year and then my
autonumber. So it would look something like this "BC0635". Anyone have any
ideas on how I can accomplish this?
Squirrel,
It is impossible to customize the actual Autonumber field in this way
because the data type for an Autonumber is "Long Integer". Since it is
a Long Integer, you cannot add letters. This is what would typically
be suggested as a "Best Practice" in your situation:
1) Leave the autonumber field alone and let it do it's own thing.
2) Add a column named "Record Entry Date", or a more appropriate name.
This column will hold the date of entry for the record.
3) If the BC is ALWAYS (and I do stress always) the same for every
record on the table, most database designers would consider it bad
practice to actually store this data. If there is ANY possibility of
BC being something else, you can add a field for that value.
When the records are presented to the user, you must combine these
fields together to achieve your desired format. As a test I made a
table with the three fields and then made a form. I put the three
fields on the form as Hidden (visible = no) fields. Then I made a
custom field to show the combined version to the end user. To do this,
I used the expression builder and here is what the expression looks
like:
=[txtBCFieldName] & Right(Year([txtEntryDate]),2) & [txtAuthID]
The first record on the form displays as "BC061", the next will show
"BC062", etc., etc....
Hope this helps!