Auto incerment of numbers depending on prefix

swaroop1012

Registered User.
Local time
Today, 06:06
Joined
Nov 21, 2008
Messages
19
Hi all,

I have a really serious problem with auto increment of numbers.

To say something about what i am trying to do, I have a autoform which should store data onto a table I made. this auto form have a field "wardname" which takes its values from a table which has 10 different wards with codes.
Ex: stafford - ST, West - WE, East - EA, North - NO etc.

I have another field set up to display the codes only.

Now my problem is, as the user enters the data in the form, and click the save button, it should start numbering and the numbering should auto increment based on the prefix.

I.e. data1: Stafford - ST: ST-1
Data2: Stafford - ST: ST-2
Data 3: East - EA: EA-1
Data 4: West- WE: WE-1
Data 5: East - EA: EA-2
Data 6: Stafford -ST: ST-3

It should incerment this way depending on the ward code. Any ideas pls.

Thanks in Advance.
 
There's no way to do this with the built-in autonumber feature. You'll need to implement your own incrementing function - this kind of question comes up quite frequently on this board - do a search on 'custom autonumber' and you'll find some useful suggestions.

Also...
data1: Stafford - ST: ST-1

Is that all going into one field? It probably shouldn't, as it looks like three or four distinct values. It's nearly always best to store just one piece of data in each column, concatenating several columns in a query, if you want to form a composite code.
 

Users who are viewing this thread

Back
Top Bottom