Creating a ticket number

J

JohnFrank

Im looking to create a new field in a databaase that I have. I want it to
start at 10000 and work in increments of 7, does anyone know how to do this?
 
A

Albert D. Kallal

I would just create a table with ONE record and ONE field.

Lets call it tblIncNumber

field = NextNum
10000

Create a public function in a standard module,

Public Function GetNextNumber

dim rst as dao.RecordSet

set rst = currentdb.OpenRecordSet("tblIncNumber")

GetNextNumber = rst(0)
rst.Edit
rst(0) = rst(0) + 7
rst.Update
rst.Close
set rst = nothing

end Function

Now, in your forms on-insert event, you go:

me!MyFieldThatNeedsTheNextNumber = GetNextNumber()
 
Top