Solved

Passing variables

Posted on 1998-11-06
5
183 Views
Last Modified: 2010-04-30
is it possible to pass variables from one form to another?
I can't seem to manage it. Any ideas?
0
Comment
Question by:SIMONBRATT
[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
  • 3
5 Comments
 

Accepted Solution

by:
hess earned 50 total points
ID: 1443634
yes... use a module and declare your variables as public from within it.
0
 

Expert Comment

by:hess
ID: 1443635
if you have a futher questions just post them as comments
0
 
LVL 15

Expert Comment

by:ameba
ID: 1443636
Simple way:
Add to your Form1 declarations:
Public CustName As String
Public Points As Long
Public UpdForm As Form

Then you can use:
Form1.CustName="Simon"
Form1.Points=50
Set Form1.UpdForm=FormCU1
Form1.UpdForm.Show

---
Better way is to use Property Get/Let pair of procedures (or Get/Set)
Private m_CustName As String ' declarations

Public Property Get CustName() As String
    CustName=m_CustName
End Property

Public Property Let CustName(ByVal vNewValue As String)
    m_CustName=vNewValue
    Caption = "Customer: " & m_CustName
End Property
0
 

Author Comment

by:SIMONBRATT
ID: 1443637
Thanks, simple answer i guess but i'm a near beginner
0
 

Expert Comment

by:hess
ID: 1443638
in a module add this line
public x as integer

in any other code you can give x a value and all x's will have that value because now x is the same variable in all of you subs and functions
0

Featured Post

Independent Software Vendors: 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!

Question has a verified solution.

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

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
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…
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 utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

726 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