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 wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Autogenerate number depending on team selected

Status
Not open for further replies.

silvami

Technical User
Dec 10, 2003
7
US
I have a database where each record needs to have an auotgenerated number in sequential order depending on the value in the "team" field. I have gooten most of the code worked out except for the part when a database is closed the variables are cleared and the next person who enters a record upon opening starts at one again. How can I store the ending value after the DB is closed so that the next user who opens the DB gets the correct value? I have included my code thus far any suggestions would be greatly appreciated
 
Don't try to save it.
In your code include something like :
Public Function NextNumber(Team as string) as integer
NextNumber = 1 + Max("[yoursequencefield]","[yourtable]","[teamfield] = " & Team)
End Function

This assumes your table has columns for sequence number and team number.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top