"Zorkmid" <(E-Mail Removed)> wrote in message
news:326D2178-D9AB-4DA0-B27B-(E-Mail Removed)...
>I have a Db with a parent-child setup.
>
> I want to build a form that will allow me to select a parent record, and
> display the child record (there may be more than one) in a subform for
> editing purposes. I can't figure out how to get the combo box in my main
> form
> to populate the subform with its child records. Any ideas?
>
> I have a combo box that allows me to select a unique field in the parent
> table, but I dont know how to get it to populate the subform. I think I
> need
> some afterupdate code or something?
>
You should not have to do anything.
So:
Build you main form based on the main (parent) table. DO NOT use a sql join
to bring in child records. Simply build a form on this main table.
To have the form "jump" for move to selected name simply use the combo box
wizard and drop in a combo box (follow the instructions).
Now, create a continues form based on the child table. Again, you can build
this form and base it on the child table. Again, don't use a sql join, nor
try to bring in any fields or parts of the parent table.
It is assumed you also correctly setup the relationship between the two
tables in the relationship window.
Now, bring up your "main" form (the one based on the parent table) in design
mode. Make sure wizard are enabled, and then drop in a sub-form control and
follow the wizard instructions (choose the correct form based on the child
table). Ms-access will setup this for you.
The end result is that if you navigate in the main form, the child form (sub
form) will follow and display the correct child records. and, in place of
using the navigation, if you use the combo box created by the wizard, then
again when the parent form move to a record, the child form will display the
correct records.
All of the above can be done without you having to write one line of code.
--
Albert D. Kallal (Access MVP)
Edmonton, Alberta Canada
(E-Mail Removed)