AutoNumber ?

kirkm1976

Registered User.
Local time
Yesterday, 20:11
Joined
Nov 26, 2007
Messages
12
Good Morning,
Is it possible to have an autonumber field start at a given number, say 9999999 and count backwards?

I have a program that is generating badge ID numbers but I have a bunch that already exist and going backwards seems like the easiest way to mesh the 2.
 
sure can do - if you look for a post I have done in the history somewher - it shows how to +1 from a given number - so just reverse it --
I' see if I can find it
 
Found it

heres my code for this in A2000

Dim NextNo As Long
Dim rs As DAO.Recordset
Set rs = CurrentDb.OpenRecordset("SELECT NextNum FROM tblnextnum")
NextNo = rs!nextnum + 1
'now update the table
rs.Edit
rs!nextnum = NextNo
rs.Update
rs.Close
Set rs = Nothing



Me.lastinvoiceno = NextNo



it gets a number from a table "tblnextnum" and from a field called "NextNum"

this works pretty well- however even this may occasion give a duplicate if two people push the button at excatly the same time -if its for 1 user then it won't happen - also gives you the ability to reset numbers

Note - I pinched this - so credit to someone else --gary

just tweak the +1 to -1
 
Thanks

Thank you. I saw the solution using an append query to count up from a given number, but nothing going back.
 

Users who are viewing this thread

Back
Top Bottom