PC Review


Reply
Thread Tools Rate Thread

Display Child Records in subform

 
 
Zorkmid
Guest
Posts: n/a
 
      21st Sep 2009
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?

-Z

 
Reply With Quote
 
 
 
 
Kipp Woodard
Guest
Posts: n/a
 
      21st Sep 2009
Use the LinkMasterFields and the LinkChildFields properties of the SubForm
control.

The value for the LinkMasterFields property will be the name of your
comboBox control. The name for the LinkChildFields property will be the name
of the field in the subform that is the link to your main form.

"Zorkmid" wrote:

> 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?
>
> -Z
>

 
Reply With Quote
 
Albert D. Kallal
Guest
Posts: n/a
 
      21st Sep 2009
"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)


 
Reply With Quote
 
Zorkmid
Guest
Posts: n/a
 
      21st Sep 2009


"Albert D. Kallal" wrote:

> "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)
>



Im not really sure what u mean when you say "create a continous form based
on the child table. I think I made it by pulliung the table into the form.
I alos dont know what you mean by "drop in a sub-form control"

-Z
>
>

 
Reply With Quote
 
Zorkmid
Guest
Posts: n/a
 
      21st Sep 2009


"Kipp Woodard" wrote:

> Use the LinkMasterFields and the LinkChildFields properties of the SubForm
> control.
>
> The value for the LinkMasterFields property will be the name of your
> comboBox control. The name for the LinkChildFields property will be the name
> of the field in the subform that is the link to your main form.
>
> "Zorkmid" wrote:
>
> > 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?
> >
> > -Z
> >


Im not sure what you mean really. There are many fields in my subform that
need to link to my main form (they are the fields of the child table)

-Z
 
Reply With Quote
 
Zorkmid
Guest
Posts: n/a
 
      21st Sep 2009
It would be really good if there was a way I could show you my DB, its hard
to explain.

"Zorkmid" wrote:

>
>
> "Albert D. Kallal" wrote:
>
> > "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)
> >

>
>
> Im not really sure what u mean when you say "create a continous form based
> on the child table. I think I made it by pulliung the table into the form.
> I alos dont know what you mean by "drop in a sub-form control"
>
> -Z
> >
> >

 
Reply With Quote
 
Zorkmid
Guest
Posts: n/a
 
      21st Sep 2009
Here is a link to a copy of my DB file, called IC.zip, its on post #19 I
think, I hope it helps. Also the thread will give you an idea of where I am.

http://www.access-programmers.co.uk/...d=1#post888624



"Zorkmid" wrote:

> It would be really good if there was a way I could show you my DB, its hard
> to explain.
>
> "Zorkmid" wrote:
>
> >
> >
> > "Albert D. Kallal" wrote:
> >
> > > "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)
> > >

> >
> >
> > Im not really sure what u mean when you say "create a continous form based
> > on the child table. I think I made it by pulliung the table into the form.
> > I alos dont know what you mean by "drop in a sub-form control"
> >
> > -Z
> > >
> > >

 
Reply With Quote
 
Albert D. Kallal
Guest
Posts: n/a
 
      22nd Sep 2009
"Zorkmid" <(E-Mail Removed)> wrote in message
news:02A391A6-2939-4EAC-8E8D-(E-Mail Removed)...


> Im not really sure what u mean when you say "create a continous form based
> on the child table.


simply launch the form wizard and follow the instructions. You simply will
create a form based on this child table.

You can choose either Tabular (that is continues form), or you can choose
Datasheet.

(either choice is fine).

so, that is how you create the continues form. (so, a continues form is
really a datasheet, or what the wizard calls Tabular).

> I think I made it by pulliung the table into the form.
> I alos dont know what you mean by "drop in a sub-form control"


the above is not really any different then dropping on a text box, or check
box, or combo or whatever. You have to just sit down and after you open a
form in design mode you have to learn how to select objects from the tool
box, and drop them onto the form.

As mentioned,, before you create these forms, you should have the table
already created. You also need to have setup a relationship between to the
two tables.

If you want some examples, consider taking a look at some of the sample
templates for access, or the northwind database sample.
http://databases.about.com/od/access/ht/northwind.htm

--
Albert D. Kallal (Access MVP)
Edmonton, Alberta Canada
(E-Mail Removed)


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
no text on subform when there are no child records susanhull@ou.edu Microsoft Access Forms 1 28th Jun 2007 03:23 AM
redrawing a form containing a subform after child records updated nChicago Microsoft Access Forms 1 23rd May 2005 08:13 AM
Child/master on subform does not change records X Microsoft Access Forms 1 16th Oct 2003 06:14 PM
combo box - filter for records matching subform child field lisa Microsoft Access Form Coding 1 11th Aug 2003 06:53 AM
Re: Subform listbox records don't reflect master/child link Emilia Maxim Microsoft Access Forms 2 30th Jun 2003 05:54 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:22 PM.