Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Reference different form's variables 1

Status
Not open for further replies.

Kib

Programmer
May 17, 2001
58
0
0
US
Is there a way to reference another forms variables without making them global variables?
so say if I am in frmEX2 I can call intIDNUM that exists in frmEX1
Is this possible?
Thanks.
Kib
 
you cannot get a variable used inside a forms VBA code because it's Subs are Private.
like so

Private Sub Combo1_BeforeUpdate(Cancel As Integer)

End Sub

but if you create a new Procedure in a form it is Public
Public Sub Test1()

End Sub

So either move the function to a Module which is public and call it from anywhere.
Or yes as you stated make it Global.
that's what Global is there for don't worry about using it. DougP, MCP

Visit my WEB site to see how Bar-codes can help you be more productive
 
Yes, you can make the variable public, if it's a module level variable:

public i as integer

Form modules are class modules.

this works in A2K. Expect it works in A97, probably won't work in A2.0
Cheers
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top