Alphanumeric Incremental field?

rodvaN

Registered User.
Local time
Today, 11:35
Joined
May 20, 2009
Messages
92
Hello, I would like to create a field that autoincrements everytime the form is opened.
It must be based with 3 letters KTN- 2 digits from month,- last 2 from year and then 5 fields for counter 00001, 00002 like -- KTN-0609-00001
KTN-0609-00002
KTN-0609-00003
KTN-0609-00004
KTN-0609-00005
So everytime I open the form it generates a new code.
How can I do this?
Thanks in advance.
Yours. rodvaN
 
forgive my ignorance but why would you want to add 5 records to a table every time you opened a form? how many users will be using this form? What is the likelyhood of opening this form more than once?

The mind boggles

David
 
I'm with DCrake on what could possibly be the point of this? Saying that however, you could do a couple of things. One would be a hidden label/textbox that is updated each time the form is opened. Then add whatever than control's value is to a table. The other way would be to run a query that looks at the last record entered each time you wanted to update said table.
 
Id prefer the hidden table..
Well actually it doesnt have to be necesary hidden.
But do you know what would be the VBA?
 
Id prefer the hidden table..
Well actually it doesnt have to be necesary hidden.
But do you know what would be the VBA?

You don't really need VBA for this. Well mostly you don't. First create a query that orders the field and gets the "Last" of that field. Then create another append query that uses the first query's value + whatever increment to insert the next value into the table. In your form use the on load even to trigger a docmd.openquery on your new append query.
 
forgive my ignorance but why would you want to add 5 records to a table every time you opened a form? how many users will be using this form? What is the likelyhood of opening this form more than once?

The mind boggles

David

It would be better if it wasnt used, then it stay still... I mean, if I dont save the record, then It would not generate on table, it would stay the same for the next time opened.
 

Users who are viewing this thread

Back
Top Bottom