Subform Fields

S

Scafidel

I've asked this before, but with too much information and I believe, no one
quite understood.
Simply, on a form with a query subform, I would like for a particular Field
of the subform (containing, usually 1-4 different items) to also appear in
(1-4) unbound text box(es) on the form. So, looking at the form with the
subform, I will see "Chocolate" and "Vanilla" on the subform AND see
"Chocolate" in a text box and "Vanilla" in another text box on the form.
 
R

Rick Brandt

Scafidel said:
I've asked this before, but with too much information and I believe,
no one quite understood.
Simply, on a form with a query subform, I would like for a particular
Field of the subform (containing, usually 1-4 different items) to
also appear in (1-4) unbound text box(es) on the form. So, looking
at the form with the subform, I will see "Chocolate" and "Vanilla" on
the subform AND see "Chocolate" in a text box and "Vanilla" in
another text box on the form.

Are "Chocolate" and "Vanilla" in the subform on different records or the same
record?

If the former I don't see any easy way to do it. I suppose using code to go
through the RecordSetClone of the subform, but what do you do as the number of
subform records increases?

If the latter you should be able to use something like...

=SubformControlName.Form!SubFormFieldName
 
J

John W. Vinson

I've asked this before, but with too much information and I believe, no one
quite understood.
Simply, on a form with a query subform, I would like for a particular Field
of the subform (containing, usually 1-4 different items) to also appear in
(1-4) unbound text box(es) on the form. So, looking at the form with the
subform, I will see "Chocolate" and "Vanilla" on the subform AND see
"Chocolate" in a text box and "Vanilla" in another text box on the form.

Are the four items on the subform four *records* in the subform's recordsource
Table?

Bear in mind - there *is no data stored in the subform*. The subform is just a
window; it displays data from a Table, via its recordsource query and
master/child link fields. The data exists in the table, and only in the table.
You won't be able to get the data *from the subform* onto the mainform; you'll
need to somehow get it from the subform's *table*, using DLookUp or VBA code.

I must ask... why??? What's the point of seeing the same data twice?

John W. Vinson [MVP]
 
S

Scafidel

Rick,
They are different records of the "Flavor" Field and I did find that I
could use the expression you gave to find the first one.
So near and yet so far.
 
S

Scafidel

I actually don't need to see the same data twice; I plan to hide the text
boxes. But, I will be able to name the text boxes and reference them in a
merge to Word (using bookmarks).
 
S

Scafidel

John,
You have given me food for thought. Now, the merge code is made up like this:
..Selection.Text = (CStr(Forms!TAB!Term))
If I could change that to find the particular table field, I might be in
business.
 
J

John W. Vinson

I actually don't need to see the same data twice; I plan to hide the text
boxes. But, I will be able to name the text boxes and reference them in a
merge to Word (using bookmarks).

Again... a merge to Word can be done using data from a Table, not using
textboxes on a Form. Can you construct a Query which retrieves the records,
using the same criteria as the master/child links of the subform? If so you
could base your merge on that query. Or, you could use the VBA code at the
link below to gneerate a concatenated string of all the subform flavors:

http://www.mvps.org/access/modules/mdl0004.htm


John W. Vinson [MVP]
 
J

John W. Vinson

John,
You have given me food for thought. Now, the merge code is made up like this:
.Selection.Text = (CStr(Forms!TAB!Term))
If I could change that to find the particular table field, I might be in
business.
--

How about

..Selection.Text = CStr(DLookUp("Term", "tablename", <some criteria>))

John W. Vinson [MVP]
 

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