How To Number Consecutively Without Using AutoNumber?

K

Katlyn

Does anyone know how to add consequitive numbering to a
table through a form without using the AutoNumber feature?
VB code that will do it?
Trouble is that when someone changes their mind, the
numbering keeps going as if the one not saved is in use.
 
B

boardrider

You can use Dmax function to get the largest number then add one to that.
Here is a sample

Public Function getNextNumber() As Long
Dim dbs As Database
Dim rst As Recordset
Set dbs = CurrentDb
Set rst = dbs.OpenRecordset("SELECT Max(tblNumber.Number) AS maxNumber
FROM tblNumber")
getNextNumber = rst!maxNumber + 1
End Function
 

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