|
Question : Creating new alphanumeric primary key in existing tables.
|
|
I have several tables that were created with manual typed in primary keys in the form of DM01, DM02, etc and another table with RD01, RD02, etc. Problem is when I need to add a new district manager or regional director, the user must know what the last combination of letters/numbers was and manually type in the next. For example, if my highest DM is DM25, they must know to type in DM26 for the next new manager. I tried changing the table to autonumber with the format of "DM"0# and various combinations, but it blew all my forms out of the water. So, in code, how can I tell it go get the max number, then assing the next number and combine that with the text portion of the ID?
|
|
Answer : Creating new alphanumeric primary key in existing tables.
|
|
use dmax
nextNumber=nz(dmax("Fieldname","Tablename"),0)+1
|
|
|
|