Access to a variable in the parent form

L

Ludwig

Hello NG

How can I access in an open form a variable of the Parent form? Many thanks
for the help.

Ludwig Ruhland
 
L

Ludwig

The Problem I have is, that I can't get access to a variable, declared in
the code section of the U-form. I've defined it as "public" but I can't get
access to this variable. With your code I get access to a control but not to
a variable. Is there a way to get access to a variable in the code section
of a U-form

Best wishes, Ludwig

Arvin Meyer said:
If it's a subform:

Me.Parent.[Name of control]

If it's a separate popup form:

Forms![Form Name]![Name of Control]

If it's a public variable in a separate form:

Form_FormName.plngVariableName
--
Arvin Meyer, MCP, MVP
Microsoft Access
Free Access downloads
http://www.datastrat.com
http://www.mvps.org/access

Ludwig said:
Hello NG

How can I access in an open form a variable of the Parent form? Many thanks
for the help.

Ludwig Ruhland
 
A

Arvin Meyer [MVP]

Try assigning it to a control. So in Form1:

Const xyz As Integer = 3

Private Sub Form_Current()
Me.txtTextBox = xyz
End Sub

And in Form2:

Private Sub Form_Open(Cancel As Integer)
Debug.Print Form_Form1.txtTextBox
End Sub
--
Arvin Meyer, MCP, MVP
Microsoft Access
Free Access downloads
http://www.datastrat.com
http://www.mvps.org/access

Ludwig said:
The Problem I have is, that I can't get access to a variable, declared in
the code section of the U-form. I've defined it as "public" but I can't get
access to this variable. With your code I get access to a control but not to
a variable. Is there a way to get access to a variable in the code section
of a U-form

Best wishes, Ludwig

Arvin Meyer said:
If it's a subform:

Me.Parent.[Name of control]

If it's a separate popup form:

Forms![Form Name]![Name of Control]

If it's a public variable in a separate form:

Form_FormName.plngVariableName
--
Arvin Meyer, MCP, MVP
Microsoft Access
Free Access downloads
http://www.datastrat.com
http://www.mvps.org/access

Ludwig said:
Hello NG

How can I access in an open form a variable of the Parent form? Many thanks
for the help.

Ludwig Ruhland
 
Top