display data other field

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

How could I show field data from a child table where ID_child equals ID_main on the main form

In other words, if the user is on the main form, but wants a textbox on the mainform with data from a child table that is usually accessed from a subform. The controlsource is not in the underlying table.
 
Have you tried DLookup?
Put this as the Control Source of an unbound textbox on your main form:
=DLookup("thefield you want", "nameofthechildtable", "[ID_child] = ID_main")

Might help.

Alp

OBWAN said:
How could I show field data from a child table where ID_child equals ID_main on the main form.

In other words, if the user is on the main form, but wants a textbox on
the mainform with data from a child table that is usually accessed from a
subform. The controlsource is not in the underlying table.
 
Thanks, I got no error, but I also got no data displayed.
=DLookup("thefield you
want", "nameofthechildtable", "[ID_child] = ID_main")

for [ID_child]

do I type [childtablename.ID] or just [ID]?
I tried both , it did't seem to matter.
 
Well, since you mentioned you were trying to display an info from a table
which is not visible on the main form you indicated, then:

"thefieldyouwant" is the field name you have given to the particular field
you want to see in your table design
"nameofthechildtable" is the name of this table

ID_child and ID_main are in accordance with what you have mentioned in your
post. If the names of these fields are different, then you should use their
actual names.

Alp
 
I don't want to be a pest, but you didn't answer either
question:

1. does one put [ID] or must one use the perior(.)
convention [tablename.ID]

2. You gave no indication of why I am getting no data
displayed....certainly, if the fieldnames were incorrect,
I would get an error message.

I guess I will have to start a new thread, as others who
might have a suggestion won't know that you and I are
stumped.

Thanks anyway
-----Original Message-----
Well, since you mentioned you were trying to display an info from a table
which is not visible on the main form you indicated, then:

"thefieldyouwant" is the field name you have given to the particular field
you want to see in your table design
"nameofthechildtable" is the name of this table

ID_child and ID_main are in accordance with what you have mentioned in your
post. If the names of these fields are different, then you should use their
actual names.

Alp

Thanks, I got no error, but I also got no data displayed.
=DLookup("thefield you
want", "nameofthechildtable", "[ID_child] = ID_main")

for [ID_child]

do I type [childtablename.ID] or just [ID]?
I tried both , it did't seem to matter.


.
 
Hi Mark,

Thanks for pointing out what I have missed to do. The intention was to try
and give an idea and since I'm not among one of the experts here, mistakes
do happen. I'll be more careful the next time. But I still think I did point
OBWAN towards the right direction at least.

Alp

mark r said:
I don't want to be a pest, but you didn't answer either
question:

1. does one put [ID] or must one use the perior(.)
convention [tablename.ID]

2. You gave no indication of why I am getting no data
displayed....certainly, if the fieldnames were incorrect,
I would get an error message.

I guess I will have to start a new thread, as others who
might have a suggestion won't know that you and I are
stumped.

Thanks anyway
-----Original Message-----
Well, since you mentioned you were trying to display an info from a table
which is not visible on the main form you indicated, then:

"thefieldyouwant" is the field name you have given to the particular field
you want to see in your table design
"nameofthechildtable" is the name of this table

ID_child and ID_main are in accordance with what you have mentioned in your
post. If the names of these fields are different, then you should use their
actual names.

Alp

Thanks, I got no error, but I also got no data displayed.
=DLookup("thefield you
want", "nameofthechildtable", "[ID_child] = ID_main")

for [ID_child]

do I type [childtablename.ID] or just [ID]?
I tried both , it did't seem to matter.


.
 
:) don't sweat it, it's the thought that counts.
If you have any further ideas, I'd love to hear them.
Best wishes

-----Original Message-----
Hi Mark,

Thanks for pointing out what I have missed to do. The intention was to try
and give an idea and since I'm not among one of the experts here, mistakes
do happen. I'll be more careful the next time. But I still think I did point
OBWAN towards the right direction at least.

Alp

I don't want to be a pest, but you didn't answer either
question:

1. does one put [ID] or must one use the perior(.)
convention [tablename.ID]

2. You gave no indication of why I am getting no data
displayed....certainly, if the fieldnames were incorrect,
I would get an error message.

I guess I will have to start a new thread, as others who
might have a suggestion won't know that you and I are
stumped.

Thanks anyway
-----Original Message-----
Well, since you mentioned you were trying to display an info from a table
which is not visible on the main form you indicated, then:

"thefieldyouwant" is the field name you have given to
the
particular field
you want to see in your table design
"nameofthechildtable" is the name of this table

ID_child and ID_main are in accordance with what you
have
mentioned in your
post. If the names of these fields are different, then you should use their
actual names.

Alp

Thanks, I got no error, but I also got no data displayed.
=DLookup("thefield you
want", "nameofthechildtable", "[ID_child] = ID_main")

for [ID_child]

do I type [childtablename.ID] or just [ID]?
I tried both , it did't seem to matter.


.


.
 
Back
Top