Solved

Multi-Form Variable

Posted on 2000-04-11
9
193 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
  • 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

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…
Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…

679 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