Subform field on the form

  • Thread starter Thread starter Jeff
  • Start date Start date
J

Jeff

Hi

Is there a way to put a text box on the form which is driven by a
subform for that form? In this instance, the subform displays a child
record which represents an actual child. The users would like to see
the child name at the top of the form, directly under the mother's
name (which is part of the form.) I know that you can do this with
another related subform, but I wanted to know if it could be done on
the form itself.

Thanks

Jeff
 
you can use an unbound textbox control on the main (parent's) form, to
display a value from the subform (child records). add the following
expression to the textbox control's ControlSource property, as

=[SubformControlName].[Form]![ControlOnSubform]

replace SubformControlName with the correct name of the subform "container"
control within the main form. make sure you use the subform control name,
not the name of the subform as it shows in the Forms tab of the database
window - sometimes the two names are the same, but sometimes not.

replace ControlOnSubform with the name of the control, within the subform,
that holds the child's name. if the name is in two or three fields (first,
middle, last names) then concatenate those fields into the above expression,
as

=[SubformControlName].[Form]![FirstNameControl] & " " &
[SubformControlName].[Form]![MiddlenameControl] & " " &
[SubformControlName].[Form]![LastNameControl]

the above goes all on one line in the textbox's ControlSource property,
regardless of linewrap in this post.

hth
 
Thanks Tina.

That works. We had talked once before, and I hadn't been able to make
it work at that time. Now that the field exists on the form, I'm
trying to use it as a LinkMaster field to work with another subform.
However, whenever I try to put the name of the textbox on the form
into the LinkMaster box, I get a message saying that the item isn't in
the list.

Could you help again?

Thanks

Jeff
 
sounds like you're clicking the Build button (...) at the right side of the
LinkMasterFields property line, and attempting to work in the Subform Field
Linker dialog box. don't do that; just type the control name(s) directly in
the LinkMasterFields and LinkChildFields property lines.

hth
 
Yes, I was using Build. Thanks. It now lets me add the field to the
LinkChild/LinkMaster fields. I feel like I'm getting very close to
this.

However, now the subform displays #Name? for the names which should
match (I went out and did some displays and found that the fields
match, so that's not the issue.) Any thoughts?

Thanks

Jeff
 
However, now the subform displays #Name? for the names which should

it's not clear which subform you're talking about here. and if you're trying
to link subformB to subformA by using a calculated control on the main form,
and if the calculated control contains a concatenation of two or three
fields from subformA - then you must have an identical calculated field in
subformB. you can't take two fields "hooked together" and try to match the
single resulting value to two *separate* fields.

how about explaining in detail exactly what you're trying to accomplish with
these two subforms on this main form, and how you're going about doing it.
then hopefully we can talk specifics, rather than a lot of "if...then...but
if instead....then...", etc, etc.

hth
 
Back
Top