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

Autonumber with option for user to amend.

Status
Not open for further replies.

Garyeag

Technical User
Mar 23, 2001
32
GB
Sound odd? Let me explain. I am working on an invoicing system. I want an autonumber facility to generate the invoice numbers so they run sequentially and just pop each time, thus avoiding errors. But, when changes have to made to an account invoices have to issued which are corrective. I would like these to carry the same number as the original. I thought if I had a long integer with one decimal point that would allow me up to 9 correction invoices for each one issued; the max ever used is 2. Any ideas on a snippet of code that will achieve this.
ie. generate the autonumber as a whole integer for each invoice, unless told otherwise in which case it will allow the user to call the invoice 3260.1, for example.
Benefit of experience passed on gratefully and humbly received.
 


I wouldn't recommend using autonumber to 'generate the invoice numbers so they run sequentially' cause autonumbers cannot be relied on to do this.

Appends and deletes will wreak havoc with your numbering system.

The autonumbering system appears to be of use only for internal database operations.

I think that this in combination with you specific needs, means that you will have to code your own numbering!


Stew



 
I would not recommend the 'Autonumber' either it will play havoc with your Additions and Deletions to the system. You should use the following code:

Dim varID As Variant

With recordset
.MoveLast 'Moves to the last record
varID = ![ID] 'Gets the number first
varID = varID + 1 'Increment the no.
.AddNew 'Add a new record
![ID] = varID 'Add the new number to start of
record
End With
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top