Creating a ticket number

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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?
 
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()
 

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

Back
Top