Link to home
Start Free TrialLog in
Avatar of Mister_Simon
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.
ASKER CERTIFIED SOLUTION
Avatar of eab111098
eab111098

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of carruina
carruina

You can define a Const with the value that you want

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


Avatar of Mister_Simon

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 ????