Remembering Values (1 Viewer)

spectrolab

Registered User.
Local time
Today, 23:55
Joined
Feb 9, 2005
Messages
116
Hi All,

Is there anyway that I can get access to "remember" values in a private sub routine after the sub routine has closed and use that value again once the sub routine is run the next time?

My value might be say 14 after the sub routine is run the first time, so I would want to start at 15 the next time the routine is run.

Any ideas?
 

JamesMcS

Keyboard-Chair Interface
Local time
Today, 16:55
Joined
Sep 7, 2009
Messages
1,819
Create the variable as public in your declarations instead of private, that should work.
 

spectrolab

Registered User.
Local time
Today, 23:55
Joined
Feb 9, 2005
Messages
116
Thanks James,

Didn't even think of that, much appreciated.
 

JamesMcS

Keyboard-Chair Interface
Local time
Today, 16:55
Joined
Sep 7, 2009
Messages
1,819
No probs, don't forget to rep me... trying to get up to two green thingies under my name :)
 

Mr. B

"Doctor Access"
Local time
Today, 10:55
Joined
May 20, 2009
Messages
1,932
Just an additional thought; If the private sub routine is going to need to start at a specific value after Access has been closed, then the value to be incremented may need to be saved to a table each time it is incremented. Also, if this is a multi-user application using the "split method" for distribution, then you might really want to consider the table method.
 

smig

Registered User.
Local time
Today, 18:55
Joined
Nov 25, 2009
Messages
2,209
save it to the registery.
savesetting/getsetting functions

but, this won't work for multi user application.
public variable won't work for multi user application too.
 

Users who are viewing this thread

Top Bottom