Form with Subform attachd - Lookup field

L

LRay67

I have a form that is created by a table, I then have a subform that is
created by another table. Which has a relationship directly with one field
(IDNumber). But I do not want to use this field as the lookup, I want to use
another field called (Owner) <-- which is a lookup field on this table from
another table.

I need to either create a BeforeEvent prior to opening the form and filter a
particular Owner's name or be able to utilize a combo box for them to select
on the Parent form and include the subform data that is associated.

I hope I tried to make myself clear...

Thanks in advance

HELP

Linda
 
M

Marshall Barton

LRay67 said:
I have a form that is created by a table, I then have a subform that is
created by another table. Which has a relationship directly with one field
(IDNumber). But I do not want to use this field as the lookup, I want to use
another field called (Owner) <-- which is a lookup field on this table from
another table.

I need to either create a BeforeEvent prior to opening the form and filter a
particular Owner's name or be able to utilize a combo box for them to select
on the Parent form and include the subform data that is associated.


Assuming your Owners table has the OwnerID and OenerName
fields, I think you want to put the unbound combo box in the
main form's header section. Set its RowSource to an SQL
statement like:

SELECT OwnerID, OwnerName
FROM Owners
ORDER BY OwnerName

Set its BoundColumn to 1 and ColumnWidths to 0;

That should be very similar to your table's Lookup field's
property settings.

Then set the subform control's LinkMasterFields property to
the name of the combo box and LinkChildFields to OwnerID
 

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