I just stubmbled across a problem I have, which I'm sure has a simple solution, but I cant think of anyway to do it? (DMAX+1 comes to mind perhaps?
)
I have an orders table, and you select an order type:
either Invoice
or Quotes
(Where ordertype=1 for invoice and 2 for quote)
At some point a quote becomes an invoice, but sometimes they dont.
Now I was going to use the OrderID (primary key) as the Invoice Number, but then realised that even the Quotes would have numbers, Quotes don't need numbers, only the Invoices. (Ordertype=1)
So when a quote isn't turned into an invoice, suddenly there is one less invoice
(e.g. if OrderID: 3 is a quote that gets rejected then we only have invoice 1,2,4,5 etc...)

I have an orders table, and you select an order type:
either Invoice
or Quotes
(Where ordertype=1 for invoice and 2 for quote)
At some point a quote becomes an invoice, but sometimes they dont.
Now I was going to use the OrderID (primary key) as the Invoice Number, but then realised that even the Quotes would have numbers, Quotes don't need numbers, only the Invoices. (Ordertype=1)
So when a quote isn't turned into an invoice, suddenly there is one less invoice
(e.g. if OrderID: 3 is a quote that gets rejected then we only have invoice 1,2,4,5 etc...)