text box to display field contents from related table

  • Thread starter Thread starter RipperT
  • Start date Start date
R

RipperT

Hi, all,

I cannot figure out the expression one would use in the control source of a
text box to have it display the value of a field from a table related to the
forms record source table. Can anyone assist?

Ripper
 
Hi Ripper

Use a query for the recordsource, and include BOTH tables in the query,
joined by the related fields. Then you can simply bind the textbox directly
to the field from the related table.
 
Thanx for the response, but this just wreaks havoc with the code that's
behind this form - and I have alot of it. I didn't have foresight enough to
start with a query; now I need an easy out. Does anyone know of an
expression I can type in and have the txtbox display that related field?

Many thanx,

Rip

--
Ripper T Smith
rippertsmith<nospam>@comcast.net
Graham Mandeno said:
Hi Ripper

Use a query for the recordsource, and include BOTH tables in the query,
joined by the related fields. Then you can simply bind the textbox
directly to the field from the related table.
--
Good Luck!

Graham Mandeno [Access MVP]
Auckland, New Zealand

RipperT @comcast.net> said:
Hi, all,

I cannot figure out the expression one would use in the control source of
a text box to have it display the value of a field from a table related
to the forms record source table. Can anyone assist?

Ripper
 
Well, personally I would revamp the recordsource, but if you REALLY don't
want to do that then use DLookup:

=DLookup("FieldToDisplay", "RelatedTable", "[ForeignKeyField]=" &
[primaryKeyField])

--
Good Luck!

Graham Mandeno [Access MVP]
Auckland, New Zealand

RipperT @comcast.net> said:
Thanx for the response, but this just wreaks havoc with the code that's
behind this form - and I have alot of it. I didn't have foresight enough
to start with a query; now I need an easy out. Does anyone know of an
expression I can type in and have the txtbox display that related field?

Many thanx,

Rip

--
Ripper T Smith
rippertsmith<nospam>@comcast.net
Graham Mandeno said:
Hi Ripper

Use a query for the recordsource, and include BOTH tables in the query,
joined by the related fields. Then you can simply bind the textbox
directly to the field from the related table.
--
Good Luck!

Graham Mandeno [Access MVP]
Auckland, New Zealand

RipperT @comcast.net> said:
Hi, all,

I cannot figure out the expression one would use in the control source
of a text box to have it display the value of a field from a table
related to the forms record source table. Can anyone assist?

Ripper
 
Thanx for the assistance. I'm just not bright enough to go back and do this
over. It's taken me weeks and tons of help from you guys to get this far
with this form, help for which I'm very grateful.

I simply stuck a subform in there with the related table as the record
source and let the wizard take care of it. It's for the user's info only;
it's not editable. Still, I'd like to know what the wizard does. I can't
find anything in the subforms property sheet that ties it to the main form.
But, again, I ain't the sharpest knife in the drawer.

Thanx again,

Rip

--
Ripper T Smith
rippertsmith<nospam>@comcast.net
Graham Mandeno said:
Well, personally I would revamp the recordsource, but if you REALLY don't
want to do that then use DLookup:

=DLookup("FieldToDisplay", "RelatedTable", "[ForeignKeyField]=" &
[primaryKeyField])

--
Good Luck!

Graham Mandeno [Access MVP]
Auckland, New Zealand

RipperT @comcast.net> said:
Thanx for the response, but this just wreaks havoc with the code that's
behind this form - and I have alot of it. I didn't have foresight enough
to start with a query; now I need an easy out. Does anyone know of an
expression I can type in and have the txtbox display that related field?

Many thanx,

Rip

--
Ripper T Smith
rippertsmith<nospam>@comcast.net
Graham Mandeno said:
Hi Ripper

Use a query for the recordsource, and include BOTH tables in the query,
joined by the related fields. Then you can simply bind the textbox
directly to the field from the related table.
--
Good Luck!

Graham Mandeno [Access MVP]
Auckland, New Zealand

"RipperT @comcast.net>" <rippert<nospam> wrote in message
Hi, all,

I cannot figure out the expression one would use in the control source
of a text box to have it display the value of a field from a table
related to the forms record source table. Can anyone assist?

Ripper
 
Back
Top