You don't say how records are sorted in your "addtional users" subform, so
not sure how you are determining what is the first record. Use a domain
function as the control source of your text box to display the value of one
or more fields in that subform record.
DFirst("[AdditionalAcctHolderName]","tblAccAcctNames]","AcctID=Forms!myMainForm!AcctID")
You'll be looking up the first record of related account holders - ones that
match the account ID that shows on the main form. This value will remain
until you move to a new record on the main form.
-Ed
================================================== =====
From Access Help:
DFirst, DLast Functions
See Also Specifics
You can use the DFirst and DLast functions to return a random record from a
particular field in a table or query when you simply need any value from
that field. Use the DFirst and DLast functions in a macro, module, query
expression, or calculated control on a form or report.
DFirst(expr, domain, [criteria])
DLast(expr, domain, [criteria])
The DFirst and DLast functions have the following arguments.
Argument Description
expr An expression that identifies the field from which you want to
find the first or last value. It can be either a string expression
identifying a field in a table or query, or an expression that performs a
calculation on data in that field. In expr, you can include the name of a
field in a table, a control on a form, a constant, or a function. If expr
includes a function, it can be either built-in or user-defined, but not
another domain aggregate or SQL aggregate function.
domain A string expression identifying the set of records that
constitutes the domain.
criteria An optional string expression used to restrict the range of
data on which the DFirst or DLast function is performed. For example,
criteria is often equivalent to the WHERE clause in an SQL expression,
without the word WHERE. If criteria is omitted, the DFirst and DLast
functions evaluate expr against the entire domain. Any field that is
included in criteria must also be a field in domain; otherwise, the DFirst
and DLast functions return a Null.
Remarks
Note If you want to return the first or last record in a set of records (a
domain), you should create a query sorted as either ascending or descending
and set the TopValues property to 1. For more information, see the TopValues
property topic. From Visual Basic, you can also create an ADO Recordset
object and use the MoveFirst or MoveLast method to return the first or last
record in a set of records.
<td*******@yahoo.com> wrote in message
news:11**********************@z14g2000cwz.googlegr oups.com...
I guess I didnt explain this very well. I have a main form with lots
of fields. Lets say the form is for a bank and contains the account
holders information such as their name and address. In bottom of this
subform I have 2 pages/tabs that display subforms. The tab that
displays by default is the account sub form and it lists all the
accounts the person has at the bank. The second tab that is not
normally displayed contains information about additional authorized
users(like the accoutns holders wifes name). Since in day to day
business the list of accounts is more important we display the list of
account subform by default(there is not enough room to put both the
subforms on the main form without tabs). However, what I want to do in
a single text box on our main form is to display the name of the first
records in the subform that contains additional authroized users.
I thought I had it by adding the source to the textbox in the main form
of
=subfrm_media_review_sec_party.Form!first_name & " " &
subfrm_media_review_sec_party.Form!last_name
My code by default displays the first authroized user, however if there
are more then one authorized users and someone tabs through the subform
of authorized useres the text box in the main form changes since
=subfrm_media_review_sec_party.Form!first_name & " " &
subfrm_media_review_sec_party.Form!last_name
shows the value of the current record in the subform. So what happens
is as I flip through the rows of the datasheet in teh subform the text
box changes. I just want to display the name from the first record of
the subform no matter what record the user in the subform is viewing.