Let's say you want to create your own autoincrementing primary key. And it's in the form of abc#### - abc001, abc002, etc. What do you all think of this? Create a table with a field say Increment. This will be set to automatically increment. Then create a field for your primary key, eg. customer id. Create an input form. In design view, bring up the property sheet for the text box Increment. In the Default value box, type =DMAX("[Increment]","Tablename"
+1 Tablename is the name of your table. Then hide this control by changing the Visible box to NO. In the Format box, type 000 (zeros) or how many places you want.
NOTE:I got the above function statement from somewhere in this thread.
Click on the text box for customer id so the property sheet reflects this control. In this control's Default value box, type ="abc"&Format([Incremant],"000"
.
Set Tab Stop to NO for both controls.
Now when you go to a new record, the Increment goes up by 1 and the result is concatenated to whatever prefix you want in your primary key.
Any critics are welcomed.
Neil
NOTE:I got the above function statement from somewhere in this thread.
Click on the text box for customer id so the property sheet reflects this control. In this control's Default value box, type ="abc"&Format([Incremant],"000"
Set Tab Stop to NO for both controls.
Now when you go to a new record, the Increment goes up by 1 and the result is concatenated to whatever prefix you want in your primary key.
Any critics are welcomed.
Neil