Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Multi-Form Variable

Posted on 2000-04-11
9
Medium Priority
?
197 Views
Last Modified: 2010-05-02
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?
0
Comment
Question by:R_N_WARD
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 3
9 Comments
 
LVL 6

Expert Comment

by:Marine
ID: 2704580
You can place the variable into a Module(.bas) file. With scope Public It will retain the value on all for all project
0
 

Author Comment

by:R_N_WARD
ID: 2704608
Say What?!
0
 

Author Comment

by:R_N_WARD
ID: 2704616
I have never used a Module before. Could you guide me through it?
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:R_N_WARD
ID: 2704623
I have never used a Module before. Could you guide me through it?
0
 
LVL 1

Accepted Solution

by:
Gotcha007 earned 100 total points
ID: 2704649
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
 

Author Comment

by:R_N_WARD
ID: 2704652
Edited text of question.
0
 

Author Comment

by:R_N_WARD
ID: 2704706
Works Like a charm, Gotcha007. Thank you.
0
 
LVL 6

Expert Comment

by:Marine
ID: 2704709
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
 
LVL 6

Expert Comment

by:Marine
ID: 2704901
Global was used previously and only is there for backward compability you shoulduse Public scope variables
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question