# Accession Autonumbering: Add collection code?

**URL:** <https://speciforum.org/t/accession-autonumbering-add-collection-code/1803>\
**Category:** Get Help\
**Created:** [June 10, 2024, 2:07pm UTC](https://speciforum.org/t/accession-autonumbering-add-collection-code/1803 "2024-06-10T14:07:15Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![fedoras](https://yyz1.discourse-cdn.com/flex029/user_avatar/speciforum.org/fedoras/32/455_2.png) [@fedoras](https://speciforum.org/u/fedoras)\
**Post date:** [June 10, 2024, 2:07pm UTC](https://speciforum.org/t/accession-autonumbering-add-collection-code/1803/1 "2024-06-10T14:07:15Z")

</div>

I got a question from an end user responsible for registering accessions for many years. We use the “YYYY-AA-nnn” format and the middle letters are used for the collection code abbreviation. She wanted to know whether it’s possible to have the collection code set automatically, e.g. “EN” or “AV”.

![image](https://canada1.discourse-cdn.com/flex029/uploads/specifysoftware/original/2X/4/4db0d3912cbb49b714bee825184862e86e0c02f1.png)

I have been looking at the visual editor, but it did not offer me any obvious routes for making this so:

 ![image](https://canada1.discourse-cdn.com/flex029/uploads/specifysoftware/original/2X/b/b5c5ed052a591098f7ad905c765e66cf62a3729c.png)

---

<div class="post-metadata">

**Author:** ![markp](https://yyz1.discourse-cdn.com/flex029/user_avatar/speciforum.org/markp/32/1184_2.png) [@markp](https://speciforum.org/u/markp)\
**Post date:** [June 10, 2024, 4:51pm UTC](https://speciforum.org/t/accession-autonumbering-add-collection-code/1803/2 "2024-06-10T16:51:02Z")

</div>

Hi Fedoras,

I believe that you should be able to configure the field format for the accession number on a per collection basis using app resources. In the configuration below, I have swapped `AA` for `EN` in the alphanumberic line.

```xml
<format system="true" name="AccessionNumber" class="edu.ku.brc.specify.datamodel.Accession" fieldname="accessionNumber" default="true">
  <autonumber>edu.ku.brc.specify.dbsupport.AccessionAutoNumberAlphaNum</autonumber>
    <field type="year" size="4" value="YEAR" byyear="true"/>
    <field type="separator" size="1" value="-"/>
    <field type="alphanumeric" size="2" value="EN"/>
    <field type="separator" size="1" value="-"/>
    <field type="numeric" size="3" inc="true"/>
  </format>

```

Then in the other collection, just modify so that `AA` is `AV` etc. The scoping is the same as for form definitions (you can do it by discipline, collection, user)
