Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Next logical Number

Status
Not open for further replies.

Dilly

Technical User
May 28, 2001
41
GB
I am creating a database and trying to merge historical demands with a new demand system. Within the old data is demand numbers that are not complete. This makes impossible to use auto numbering. Is it possible to creat a field that can look at the last demand number and add 1. therefore creating a new demand number which will be the next in the sequence
 
Yes. If this is a numberic field, then this can be relatively easy.

One way would be to add this code to the default value of the DemandNumber field.

= DMax("DemandNumber","Mytable")

This is cool if only one user will be adding the number at a time. If multiple new records are being entered at once, you may want to put this expression in the Before Update of the record.

If your numbering system contains alphas, then you may need to drop the alpha part first (using the Left() or Right() funtions) before doing the Dmax function.

ljprodev@yahoo.com
ProDev, MS Access Applications B-)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top