Question Creating Invoice Numbers

fleurette

Registered User.
Local time
Today, 18:58
Joined
May 6, 2013
Messages
18
Hi
I am trying to create an auto-sequential order number

Example:
AB000112 - AB is standard prefix, ''0001'' is the first invoice number, ''12'' is the year 2012.

so the next order number should read AB000212 and the next AB000312

Out of this, I have to issue several debit notes relating to the same order number when the payments are due from customers over a period of time, this will be
001AB000112
002AB000112
003AB000112

Is there a way to do it without using any programming language or VBA?
I do not know either of this

Can such numbers be the primary key?

Thanks
feeling very clueless after trying many times but nothing works. :banghead:
 
Such numbers can be the primary key.

I'm sending you two functions

' Increment string
Public Function incAlphaNum(inputString As String) As String
Dim i As Long, formatStr As String
For i = Len(inputString) To 1 Step -1
If Not (IsNumeric(Mid(inputString, i, 1))) Then Exit For
formatStr = formatStr & "0"
Next i
If i = Len(inputString) Then
incAlphaNum = inputString
Else
incAlphaNum = Left(inputString, i) & Format(Val(Mid(inputString, i + 1) + 1), formatStr)
End If
End Function

' increment string with pre definition increase number(NrRrites).
Function incAlphaNumSipas(StringuHyres As String, NrRrites As Long)
Dim i As Long, formatStr As String, j As Long, VarStrngu As String
VarStrngu = StringuHyres
For i = Len(StringuHyres) To 1 Step -1
If Not (IsNumeric(Mid(StringuHyres, i, 1))) Then Exit For
formatStr = formatStr & "0"
Next i
If i = Len(StringuHyres) Then
incAlphaNumSipas = StringuHyres
Else
incAlphaNumSipas = Left(VarStrngu, i) & Format(Val(Mid(VarStrngu, i + 1) + NrRrites), formatStr)
End If
End Function
 
Thanks.
But I unsure of what to do with these codes.

I only know how to use the wizards.

Any guidance what to do?
Thanks
 
Hi
Anyone able to advise what am I suppose to do with the codes?

Thanks
 

Users who are viewing this thread

Back
Top Bottom