Solved How to increment a number with VBA

nector

Member
Local time
Today, 09:50
Joined
Jan 21, 2020
Messages
462
Dear all

I'm now screwed out here :

I want to increment a number in format

(1) 0000010 to 99
(2) 0000100 to 199
(5) 0000200 to 299
ETC

I have tried to use the primary key but its considering the zeros


Code:
Private Sub itemTyCd_AfterUpdate()
Me.itemCd = Ctri("000000") & Me.ProductID
End Sub
 
why not just use the format function?

format(productid,”0000000”)

will add the preceding zero’s and change it from a Number to text
 
Change this according to your controls on the form.

Code:
Function Test(myString As String) As String
        
    Test = Right("00000000" & Val(myString) + 99, 7)
    
End Function
 

Users who are viewing this thread

Back
Top Bottom