Solved

Multi-Form Variable

Posted on 2000-04-11
9
191 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
Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

 

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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…

816 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now