How to code a subform in VBA?

J

jbeggie

I am trying to create a subform on an unbound form in VBA. I want t
write codes to be able to control the disply of my subform by say
textbox. This is how I want it to work.
The record that is feeding/supporting the subform has a FirmID Fiel
that associate it with a particular firm. As the FirmID changes I wan
the produt/brands that is associated with that particular firm t
display in the subform. Remember the subform is supported by th
brand/product table that has a firmID field.
Could someone please help on how or the best way to do this
 
S

Sprinks

Hi, jbeggie.

Firm is in a one-to-many relationship with Brands, so base your main form on
Firm (or a query thereof), base your continuous subform on Brands, and link
them by the FirmID, i.e., set the subform's LinkMasterFields and
LinkChildFields properties to the name of the field in the main form and
subform's RecordSources, respectively.

Hope that helps.
Sprinks
 
J

jbeggie

Thanks Sprinks


=?Utf-8?B?U3ByaW5rcw==?= said:
Hi, jbeggie.

Firm is in a one-to-many relationship with Brands, so base your mai
form on
Firm (or a query thereof), base your continuous subform on Brands, an
link
them by the FirmID, i.e., set the subform's LinkMasterFields and
LinkChildFields properties to the name of the field in the main for
and
subform's RecordSources, respectively.

Hope that helps.
Sprinks
 
J

John Vinson

I am trying to create a subform on an unbound form in VBA. I want to
write codes to be able to control the disply of my subform by say a
textbox. This is how I want it to work.
The record that is feeding/supporting the subform has a FirmID Field
that associate it with a particular firm. As the FirmID changes I want
the produt/brands that is associated with that particular firm to
display in the subform. Remember the subform is supported by the
brand/product table that has a firmID field.
Could someone please help on how or the best way to do this?

Use the *name of the mainform control* which contains the FirmID as
the subform's Master Link Field. That option isn't offered by the
wizard or the dropdown box, but you can type it in.

John W. Vinson[MVP]
 
Top