Manually advance unique numbers in Access?

G

Guest

Need procedure / function to manually advance customer numbers in Access when
user adds new record. Procedure would have to find highest existing number,
than add 1, then return new number to field in DB. (Customer number field
type is text, though all data consists of numbers, no letters).
 
S

Stefan Hoffmann

hi Jimmy,
Need procedure / function to manually advance customer numbers in Access when
user adds new record. Procedure would have to find highest existing number,
than add 1, then return new number to field in DB. (Customer number field
type is text, though all data consists of numbers, no letters).
Use

Nz(DMax("Field", "Table"), 0) + 1

This function is not multi-user aware. So a unique index on your field
is required.

Change your field type to Number(Long Integer). If leading zeros are
needed then use an appropriate display format.

mfG
--> stefan <--
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top