|
 |
access thread: Reference controls on a second sub form
Message #1 by "M.Puk" <M.Puk@x...> on Thu, 28 Feb 2002 20:12:19 +1300
|
|
This is a multi-part message in MIME format.
------=_NextPart_000_000F_01C1C094.39A6A580
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Thanks to Omar Chaudry for the reply but still no success.
I have since made up a simple test form consisting of a main form with 2
sub forms(no tables just unbound controls). Each form has 2 unbound text
boxes to test the various control source expressions in. Using this
simple set up I have tried to use various expressions in the control
source to reference the controls on the other sub form but the error I
get is: Cant find the field "FORMS" . For some reason it thinks the
forms identifier in the expression is a field name. Also get a ?Name
error sometimes.
I have tried using the expression builder but get the same result.
If someone has got a minute to throw a similar form together and have a
go at referencing:
1: the second sub from the first sub
2: the same control on the main form from each of the forms i.e. end up
with the same value in both sub forms from the one box on the main form.
Cheers,
Murray Puklowski
M.Puk@e...
Message #2 by Barry Martin Dancis <bdancis@c...> on Thu, 28 Feb 2002 11:53:15 -0500
|
|
This is a multi-part message in MIME format.
--Boundary_(ID_9AabSp+E0ceTn5aved/sFw)
Content-type: text/plain; charset=iso-8859-1
Content-transfer-encoding: 7BIT
Murry,
The subform appears as a control on the main form. If a subform of type EmployeeForm is a control on the main form with the name
of Employee, then the main form references the subform by -
Employee.Form.
If the text box on the subform is call ActiveTextBox then the master sets the sub by
Employee.Form.ActiveTextBox = "YES"
I'm not sure if the two forms can talk directly to each other but you could set up variables in the sub forms that contain pointers
to the their sister subforms and have the main form fill the values of the pointers. For example, if the second form is HomeAddress
with a variable
public myEmployeeForm as Form
then during loading of the main form you could give a pointer of the employee form to the HomeAddress form by
set HomeAddress.Form.myEmployeeForm = Employee.Form
Give it a try.
Barry
p.s. In real code, I would have myEmployeeForm as a private variable and a use public property of the subform to fill it
public property set EmployeeForm(NewForm as form)
begin
set myEmployeeForm = NewForm
end
----- Original Message -----
From: M.Puk
To: Access
Sent: Thursday, February 28, 2002 2:12 AM
Subject: [access] Reference controls on a second sub form
Thanks to Omar Chaudry for the reply but still no success.
I have since made up a simple test form consisting of a main form with 2 sub forms(no tables just unbound controls). Each form has
2 unbound text boxes to test the various control source expressions in. Using this simple set up I have tried to use various
expressions in the control source to reference the controls on the other sub form but the error I get is: Cant find the field
"FORMS" . For some reason it thinks the forms identifier in the expression is a field name. Also get a ?Name error sometimes.
I have tried using the expression builder but get the same result.
If someone has got a minute to throw a similar form together and have a go at referencing:
1: the second sub from the first sub
2: the same control on the main form from each of the forms i.e. end up with the same value in both sub forms from the one box on
the main form.
Cheers,
Murray Puklowski
M.Puk@e...
Message #3 by "Gregory Serrano" <serranog@m...> on Thu, 28 Feb 2002 18:31:45
|
|
Murray,
> If someone has got a minute to throw a similar form together and have a
> go at referencing:
> 1: the second sub from the first sub
> 2: the same control on the main form from each of the forms i.e. end up
> with the same value in both sub forms from the one box on the main form.
Main Form Name: M1
Subform 1 (in M1) Name: S1
Subform 2 (also in M1) Name: S2
Other Open Form (not a Subform of M1, S1, or S2): M2
Field in Question: ID
Ref. ID is in M1 ID is in S1 ID is in S2 ID is in M2
---- ----------- ------------- ------------- -----------
M1 Me.ID Me.S1.Form.ID Me.S2.Form.ID Forms!M2.ID
S1 Forms!M1.ID Me.ID Forms!S2.ID Forms!M2.ID
S2 Forms!M1.ID Forms!S1.ID Me.ID Forms!M2.ID
M2 Forms!M1.ID Forms!M1.S1.Form.ID Forms!M1.S2.Form.ID Me.ID
I hope I got this straight! :)
Greg
|
|
 |