Referencing Subform from Another Form

A

ATSBC03

I have a search form and am trying to pick up data from another form to be
displayed in my search form when criteria matches. The search form worked
perfectly until I changed the way my database worked and changed some forms.
Now I am getting #Name in my text fields of the search form. Some background
information regarding my database is that the search form is currently bound
to a table risk. I have a data entry form (ptinfo) that has tabs
(ptinfo,incident,complaint). The form ptinfo also is bound to table risk. On
the incident tab i have a subform occurrence where data is entered and/or
changed. The subform also includes tabs. These tabs (inc, lab, track, etc.)
is where the data is entered and displayed using combo and text boxes, etc. I
am trying to reference reportdate in my search form so that the data can be
displayed.

form ptinfo - bound to table risk
form search - bound to table risk

ptinfo-occurrence subform-inc tab -reportdate (this is the field i am trying
to reference without success)

Please let me know if you need more information. Thank you in advance for
any help.
 
J

Jeff Boyce

When you refer to data on your subform, are you using something like:

Forms!YourSubformsMainForm!YourSubformControlName.Form!YourControlOnSubform


--

Regards

Jeff Boyce
Microsoft Access MVP

Disclaimer: This author may have received products and services mentioned in
this post. Mention and/or description of a product or service herein does
not constitute endorsement thereof.

Any code or pseudocode included in this post is offered "as is", with no
guarantee as to suitability.

You can thank the FTC of the USA for making this disclaimer
possible/necessary.
 
A

ATSBC03

Yes. I have tried the below and various other was of referencing a subform. I
am quite familiar with that. I am wondering if it has something to do with
the fact that my "search" form is not connected to all the forms that I am
trying to get information from. Before I had just one form withe everything
on it that connected to my search form via a reference to the same table.
However, I have changed my database and now have information on the main form
and also on the subform. It is only the subform that I am having problems
with the main form controls I am able to reference.

I also want to double check that when you say "...YourSubformControlName..."
that you mean the name of my subform. I want to make sure I haven't
misunderstood something. I have been working on this so much that I wanted to
make sure that I haven't confused myself along the way. Thanks for your help.
 
A

ATSBC03

That's what I thought. I was wondering however if the control for my subform
has changed since the actual control that I am trying to access is located on
a tabbed subform. My subform is on a tab of the mainform and then the control
is on a tab of the subform. Would this change how I access the subform?

BruceM via AccessMonster.com said:
The subform control is the "box" on the main form containing the subform.
The subform and the subform control may or may not have the same name. The
Source Object of the subform control is the actual name of the form. However,
the subform control itself can have whatever name you choose for it.

Yes. I have tried the below and various other was of referencing a subform. I
am quite familiar with that. I am wondering if it has something to do with
the fact that my "search" form is not connected to all the forms that I am
trying to get information from. Before I had just one form withe everything
on it that connected to my search form via a reference to the same table.
However, I have changed my database and now have information on the main form
and also on the subform. It is only the subform that I am having problems
with the main form controls I am able to reference.

I also want to double check that when you say "...YourSubformControlName..."
that you mean the name of my subform. I want to make sure I haven't
misunderstood something. I have been working on this so much that I wanted to
make sure that I haven't confused myself along the way. Thanks for your help.
When you refer to data on your subform, are you using something like:
[quoted text clipped - 31 lines]

--
Message posted via AccessMonster.com


.
 
A

ATSBC03

I still cannot reference my control on the subform from my search form. I
have never had problems like this before in reference subform controls. I
don't know what I am doing wrong. Do you have any suggestions? I am currently
working on the below.

=Forms!frmPatientInfo!frmOccurrenceReport.Form![Date of Occurence]

BruceM via AccessMonster.com said:
No. For purposes of referencing a control such as a text box the tab control
is irrelevant. The individual tab pages are properties of the tab control,
so to reference, say, a tab caption you need to reference the tab control,
but controls on a tab page are referenced as if there was no tab control.
That's what I thought. I was wondering however if the control for my subform
has changed since the actual control that I am trying to access is located on
a tabbed subform. My subform is on a tab of the mainform and then the control
is on a tab of the subform. Would this change how I access the subform?
The subform control is the "box" on the main form containing the subform.
The subform and the subform control may or may not have the same name. The
[quoted text clipped - 20 lines]

--
Message posted via AccessMonster.com


.
 
A

ATSBC03

I can't believe I overlooked this before but after reading your last post I
realized that the form frmPatientInfo is not open. I am trying to reference
this form from another form that is bound by the same main table. I.e.
frmPatientInfo and frm Search are both bound to frmRisk. Is there a way to
"load" (i don't want to open frmPatientInfo) at this time or is there another
way to reference the controls on an unopened form. Is there another way that
this should be done instead? I really appreciate your patience and all your
help.

BruceM via AccessMonster.com said:
It looks OK, assuming frmPatientInfo is open; frmOccurrenceReport is the name
of the subform control, which may be different from the name of the form
being used as the subform (the subform control's Source Object); and
everything is spelled correctly.
I still cannot reference my control on the subform from my search form. I
have never had problems like this before in reference subform controls. I
don't know what I am doing wrong. Do you have any suggestions? I am currently
working on the below.

=Forms!frmPatientInfo!frmOccurrenceReport.Form![Date of Occurence]
No. For purposes of referencing a control such as a text box the tab control
is irrelevant. The individual tab pages are properties of the tab control,
[quoted text clipped - 11 lines]

--
Message posted via AccessMonster.com


.
 
J

John W. Vinson

I can't believe I overlooked this before but after reading your last post I
realized that the form frmPatientInfo is not open. I am trying to reference
this form from another form that is bound by the same main table. I.e.
frmPatientInfo and frm Search are both bound to frmRisk. Is there a way to
"load" (i don't want to open frmPatientInfo) at this time or is there another
way to reference the controls on an unopened form. Is there another way that
this should be done instead? I really appreciate your patience and all your
help.

If frmPatientInfo is not open how can your query determine WHAT it is that you
want to find?????

You're asking it to use the value of a control on the form as a criterion.
What value do you want to use if there *is no control*?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top