Mister_Simon
asked on
Setting a starting point for counter
I am utilising a counter that can be called from various points in a project.
The routine is in a module and evertime it is called the integer increments by one. However I need the counter to start from 99004500 therefore how do I set this as the initial integer value.
The routine is in a module and evertime it is called the integer increments by one. However I need the counter to start from 99004500 therefore how do I set this as the initial integer value.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Works Ed !!
although had to use a form.SHOW in the module rather than form.LOAD as that did not work.
Do you think this will cause any problems ????
although had to use a form.SHOW in the module rather than form.LOAD as that did not work.
Do you think this will cause any problems ????
In the next code every time you click the Command Button you can see the secuencie
99004501 , 99004502 , ...
Const INIT_VALUE = 99004500
Private Sub Command1_Click()
Dim result As Long
MsgBox INIT_VALUE + counter()
End Sub
Public Function counter() As Integer
Static aux As Integer
aux = aux + 1
counter = aux
End Function