Custom Autonumber Format

  • Thread starter Thread starter tycoon
  • Start date Start date
T

tycoon

Guest
Ms Access.... Custom Autonumber Format

Hi all.......I'M Using Ms Access to develope a db...which I want to set an autonumber format like this "FAMAOR-YY-XXXXX"....

The YY = Year and the xxxxx = autonumber...and the example of

generate autonumber should be

likethis "FAMAOR0200001".....can anybody

tell me how to do this
 
There are a gazillion posts here on this very topic. If you care to search, I'm sure you'll find a relevant one. The recommended solution is to use three fields. One to hold the text, the second to hold the date the record was added, and the third is defined as an autonumber. Then to display the field in the format you want -

TextString & Format(DateAdded, "yy") & Format(AutoFld, "00000")
 
Hello Pat......Thanx for reply but can tell a little bit more on how to

do this coz I'm kindda new in this whole db thing and I aslo don't

have a clue how to do the string at all...Please help coz I don't

even know where to start......may god bless you for your help

p/s: Sorry for Inconvenience but I'm really green in this enviroment and hope for your guidence
 
You can use the expression as the controlsource of a control on a form or report by preceeding it with the = sign.

=TextString & Format(DateAdded, "yy") & Format(AutoFld, "00000")

You can use it in a query:

Select TextString & Format(DateAdded, "yy") & Format(AutoFld, "00000") As FormID From YourTable;

Queries can be used as the control source for forms or reports or the row source for list and combo boxes.

Just change the field names to the three names that you have chosen for the three columns from your table.
 
I'm going to amplify this a bit.

If your three-part record identifier allows for the separate unique number to reset when the year changes, you cannot use an Autonumber field for this purpose. You must maintain that yourself. This is a case of a key that appears to have meaning inherent in something to do with the record (year number, in this case). Whenever you have such a case, you can NEVER use an autonumber if it has to reset with each year.
 

Users who are viewing this thread

Back
Top Bottom