Solved

Multi-Form Variable

Posted on 2000-04-11
9
196 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
Industry Leaders: 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 25 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

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
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
Course of the Month6 days, 1 hour left to enroll

627 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