Multi-Form Variable

I have a testing program with mutiple Forms and I want to use a variable to record what the tester receves as a score. For example,  in the begining of the program, A = 50. If the tester gets one wrong, A = A - 1. The problem is that A will not retain its value form to form.  I know now that I must put the variable in a Module. I have never used a Module before. How do I do This?
R_N_WARDAsked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
Gotcha007Connect With a Mentor Commented:
go to the menu project and choose "add a module"
in this new module, add this line :
global xxx as integer
where xxx is your variable name.

this variable will be accessible on all the project and it will retain his value.


0
 
MarineCommented:
You can place the variable into a Module(.bas) file. With scope Public It will retain the value on all for all project
0
 
R_N_WARDAuthor Commented:
Say What?!
0
Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

 
R_N_WARDAuthor Commented:
I have never used a Module before. Could you guide me through it?
0
 
R_N_WARDAuthor Commented:
I have never used a Module before. Could you guide me through it?
0
 
R_N_WARDAuthor Commented:
Edited text of question.
0
 
R_N_WARDAuthor Commented:
Works Like a charm, Gotcha007. Thank you.
0
 
MarineCommented:
It doesn't have to be a module it can be your standard form. Just in General Declaration place Public x as Integer or in Module Place Public x as Integer.
You can use this variable then thoughout your code.
0
 
MarineCommented:
Global was used previously and only is there for backward compability you shoulduse Public scope variables
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.