subform call subform control

  • Thread starter Thread starter Tony
  • Start date Start date
T

Tony

i have a main form with 2 subforms (ABC & form_assignee)

The following code call from main form to subform form_assignee, it is ok
If [Form_assignee]!assignee <> assignperson Then

i wish the above code also work in the subform
how can i write if the above code call from another subform (ABC) to subform
form_assignee

Thanks a lot for your assistance, i try many times but still fail to make
the VB works.
 
Try:
If Me.Parent.[xxxx].Form.assignee <> assignperson Then
where xxxx is the name of the other subform control.

Parent takes you form the subform containing the code back to the main form.

I'm guess that the subform control is not named "Form_assignee", since that
would be the name of a module for a form named "assignee". If you are not
sure of the name:
- open the main form in design view,
- right-click on the subform control, and choose Properties.
- on the Other tab of the subform control, the property is called Name.

The other subform control has a Form property, which you use to refer to the
form in the subform control.

And finally, we assume that "assignee" is a text box on the other subform.
 
Hi Allen

Thanks a lot for your help


Allen Browne said:
Try:
If Me.Parent.[xxxx].Form.assignee <> assignperson Then
where xxxx is the name of the other subform control.

Parent takes you form the subform containing the code back to the main form.

I'm guess that the subform control is not named "Form_assignee", since that
would be the name of a module for a form named "assignee". If you are not
sure of the name:
- open the main form in design view,
- right-click on the subform control, and choose Properties.
- on the Other tab of the subform control, the property is called Name.

The other subform control has a Form property, which you use to refer to the
form in the subform control.

And finally, we assume that "assignee" is a text box on the other subform.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

Tony said:
i have a main form with 2 subforms (ABC & form_assignee)

The following code call from main form to subform form_assignee, it is ok
If [Form_assignee]!assignee <> assignperson Then

i wish the above code also work in the subform
how can i write if the above code call from another subform (ABC) to
subform
form_assignee

Thanks a lot for your assistance, i try many times but still fail to make
the VB works.
 
Back
Top