473,396 Members | 1,760 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

On child form create bound list box to show related records from parent form

LeighW
73 64KB
Hi all,

I have two tables with a many-to-many relationship which is causing many problems. My parent and child forms are linked via a junction table. I want to make it possible to create a read-only version of the child table so that you don't have to link to it from the parent table.

A form linking the two together has been created with a combobox where you can pick and choose which records relate to each other.

I'd like on the child form there to be a list box or combo box which shows the records from the parent table linked to that record from what is picked within the comboboxes of the "junction form".

In essense it would mean that people reading the child form would know which names the record is based on if they didn't want to go via the parent form to read it.

Any help would be great,

Leigh
Jul 4 '12 #1
20 34914
zmbd
5,501 Expert Mod 4TB
I'm not following your logic here... are you saying that you already have a Parent/Child form and that you do not want users to be able to edit the related records in the child form?
Jul 4 '12 #2
LeighW
73 64KB
Sorry this is my beginner side of access showing. When I said Child form it's not that at all, it's because it used to be like that. It's a separate form. I'll explain using Form 1 and Form 2.

Form 1 (Based on Table 1) and Form 2 (Based on Table 2) are not directly linked (they used to be that's why I used that language). A junction table (Table 3) between the two forms links them to create a many-to-many relationship. I have a form (Form 3) which is based on a query using all 3 tables. I use Form 3 to create new records which then also appear in Form 2. Form 3 lets me show the records linked between Table 1 and Table 2. I use yet another form (Form 4) which has a parent (Table 1)/child (Table 2 and 3) relationship with a combobox in the child form which allows me to choose the records from Table 2 that link to Table 1. The records chosen then also show in Form 3.

Form 3 cannot be looked at if you want to see the records from table 2 with no duplicate records. Form 2 however shows only the records from Table 2 (no duplicates).

Form 1, Form 3 and Form 4 share a field from table 1, lets call it, "Title" field (Datatype Text). I'd like "Title" to also show in Form 2 (as well as records from Table 2) as an uneditable list or combo so that readers can see which "Titles" the records in Form 2 are related to from Form 1.

I hope that makes more sense and there could be a way of doing what I want.

Leigh
Jul 4 '12 #3
zmbd
5,501 Expert Mod 4TB
So you'd be using the combobox on form 2 basically like a filter, yes/no?
I'm not sure if this is exactly what you are after; however, NeoPa has a pretty good example of form filtering here:http://bytes.com/topic/access/insigh...filtering-form in anycase, the information should hopefully get you on the right track.
z
Jul 4 '12 #4
LeighW
73 64KB
Thank you, I'll have a good look at it and yes I believe that is what I'm after
Jul 6 '12 #5
zmbd
5,501 Expert Mod 4TB
@LeighW
Thinking about this a tad... in addition to using the "filter" concept, you might look at creating a new form/subform setting properties to prevent adding/changing records at the form/control level in their properties. Rabbit and I had a thread discussing this... Rabbit points out that the advantage is that no VBA is needed to get the information out of the db.

Discussion: Advantages of a Subform vs. Filtering

OK, off to do the Family thing with the In-Laws ... really not as bad as it sounds... if they feed me! ;-)

-z
Jul 6 '12 #6
ariful alam
185 100+
Are you saying:

Table 1 linked to -> Table 2
and
Table 2 linked to -> Table 3?

And you like to use Table 2's Form to view records on Table 1 & Table 3 in a Form.
Jul 8 '12 #7
zmbd
5,501 Expert Mod 4TB
Ariful,
In post #3, Leigh gives the relationships... I had to read it twice to follow too...

So, if one ignores the forms to start out with then, from what is posted in #3, I understand the following to be true(an Leigh might need to correct):

tbl_one -> (1:m) tbl_three (m:1) <- tbl_two

There are forms based on each of these tables...
frm_one -> tbl_one
frm_two -> tbl_two
frm_three -> tbl_three

There is an additional form ... say.... frm_four.
Now frm_four gets a tad confusing...
I'm not sure that frm_four is related to our solution; however, it is good to have an understanding of the form.

From what I understand for frm_four:
frm_four->tbl_one:sub_frm_four_A
Somehow, sub_frm_four_A is related to tbl_two and tbl_three
Somehow, sub_frm_four_A will allow a linking between tbl_one and tbl_two.... this is where having a copy of the DB with some made-up records would be helpful

In any-case, there is a field [Title] that is currently common to frm_one, frm_three, and frm_four.

Leigh appears to want that same field to show up on frm_two. The control that will be using [Title] as it's source needs to be un-editable and filters the records shown in frm_two to those related only to the [Title].value selected

To me, there are two ways that appear to be possible solutions to the question asked based upon the available information... the first was the link offered for NeoPa's article (link in post #4) and the second is to create a form/subform wherein the parent form's controls are blocked from being editied (and I figure, also from adding new records?), some of the merits of which are in the thread noted in post #6.

Once again... Leigh is certainly encouraged to correct any errors I may have made. (esp about frm_four... normally a parent form controls the subform; however, we may be talking nomenclature... just don't know :) )


-z
Jul 8 '12 #8
ariful alam
185 100+
@zmbd, are you saying that @LeighW explained in post#3 the following:

Two individual tables named Table_1 and Table_2 are linked with another table named Table_3.

Form_1 is a direct form of Table_1.
Form_2 is a direct form of Table_2.
Form_3 is a queried form of Table_1, Table_2 and Table_3 to show the link data in Table_1 and Table_2 via Table_3.

And

He used Form_3 also to entry a new record in Table_1 and Table_2.

He has also another form Form_4 that use Table_1 as parent object and Table_2 and Table_3 as child objects.

Are those right?

If those right, now tell me in Form_4; Table_1, Table 2 and Table_3 used as new form or he used the old forms Form_1, Form_2 and Form_3?

And which is search chooser section in Form_4 and which are result shower section in Form_4

Thanks
Jul 9 '12 #9
LeighW
73 64KB
Yes everything both of you have said are right. Thank you for understanding! Many-to-many relationships are difficult to explain/grasp. I'm back from the weekend + braindead Monday so I'll have a look at both methods and see which is best. A subform might be a bit clunky for just one field, that's perhaps the drawback for that method but I see how it would work.

Ariful alam - You are right in how the forms and tables work. I'm not sure I follow your question though? Form 4 is just used to choose the links between Table 1 and Table 2 in the many-to-many relationship using a combobox record selecter. Form 4 is always filtered to the record from Form 1 (as you are directed to Form 4 from Form 1) and you cannot edit/add to the parent in Form 4. Form 4 is just playing with existing data from Tables 1 and 2 and creating duplicates in Table 3 to create the many-to-many linkage.

Also I hope you had a good time at the In-Laws zmdb (it's usually a daunting experience!)
Jul 10 '12 #10
zmbd
5,501 Expert Mod 4TB
Thnx for clearing up form 4...

The In-Laws... help FIL lay 3yards concrete... long, hot day... but you know, he's helped us out... and a 65ish old man doesn't need to be doing that kind of work in the heat. However, I think I've come down with something so I may be just lurking for the next few days.... I don't do the sick thing very well :(

-z
Jul 10 '12 #11
ariful alam
185 100+
If i create a Form named Form3 using a query value of Table_1, Table_2 and Table_3, the Form3 will be a parent-child form or a linked form of two form. in both cases, in child form or in linked form multiple data can be added for the parent form. but it is not possible to add multiple data in parent form because of every child/linked form data.

do you both agree?
Jul 10 '12 #12
zmbd
5,501 Expert Mod 4TB
Ariful... I'm not sure where you're going with this train of thought as on the surface it does not appear to relate to OP question. (Could be that I'm just under the weather too)

From my understanding in the OP, LeighW only needs a way to show [Title].value as it relates to the records shown on frm_two.

IMHO, w/o having a copy of the DB w/ test data, as I suggested in post 4 and 6; either a form/subform or the information in NeoPa's tutorial should provide the answer to the question. If not, I suspect LeighW will be back (and I hope will tell us either way)

I'm sure that there different ways to restructure LW's DB; however, W/O the DB I wouldn't even want to start such an adventure :)

-z
Jul 10 '12 #13
ariful alam
185 100+
@ZMBD, in post#3 LeighW wrote,

"I use Form 3 to create new records which then also appear in Form 2. Form 3 lets me show the records linked between Table 1 and Table 2."

that's why i post the above before you. What you suggested NeoPa's tutorial is solved by VBA code. But my problem is I don't like to do VBA code in MS Access database. I try anything in MS Access using Expression Builder or Macro. So, that's why I am finding a way that may not need to add VBA code directly.

Thanks.
Jul 10 '12 #14
LeighW
73 64KB
Looking at NeoPa's method it looks a bit too complicated for what I need though it does seem interesting in how it works.

Z - I hope you get better (at least you had sunshine)! and cheers for the help.

Ariful - That's correct thanks for the help so far.

Edit - Also I'd give the DB but it would take an awful lot of time to change it to non-sensitive
Jul 10 '12 #15
ariful alam
185 100+
@LeighW,

did you saw post#12 here in serial by me? do you need that in your work? if yes, is that in that way is described there or any other thing?

is it possible to provide a copy of your work without data here?

thanks.
Jul 10 '12 #16
zmbd
5,501 Expert Mod 4TB
Ariful... I'm sorry, I still do not follow how your suggestion will answer the OP.

LeighW... NeoPa's tutorial does appear to be staggering upon first read; however, I assure you that it is much easier to do than to write :)

Both: If your are of the group that likes to avoid VBA as much as possible then the link to the thread between Rabbit and Myself (#6) about the form/subform is as Ariful suggested one such solution.

In anycase, I hesitate to offer any specific solution to the question as I do not have a clear understanding of the database. However, as there is a common field [Title] you could create something along the lines of the following where I have a single parent form and three child forms. Selecting from the list box in the upper left corner causes an update against the three subforms as they are linked to the value of the control




-z
Attached Images
File Type: jpg orderstart.jpg (38.8 KB, 1199 views)
Jul 10 '12 #17
ariful alam
185 100+
@zmbd,

what u did in your attached image is easy to do using query of the tables which are taking the list/combo box value as parameter. with every selection of list/combo box it can be done by macro action "requery" in the list/combo box's "after update" event. is it right?
Jul 10 '12 #18
zmbd
5,501 Expert Mod 4TB
There is no code, macro nor VBA, driving the subform updates.

The three subforms are linked in the properties...
for the subform showing the items requested:



Just noticed that "List11" this is very old database... now days I would have had something like. z_lst_labid for the name for the master field.
-z
Attached Images
File Type: jpg subform_request.jpg (29.6 KB, 1171 views)
Jul 10 '12 #19
ariful alam
185 100+
@zmbd,

a BIG BIG & BIG thanks.

It may be done by the wizard when we add a subform. Is it?
Jul 10 '12 #20
zmbd
5,501 Expert Mod 4TB
Hmmm... I tend to do these by hand as I rename controls... I haven't tried it using the Wizards... worth a try.

I gave up on the wizards years ago (except for the very few cross-tab) because I had to go in and change so much that I decided it was easier to just do the work by hand. :)

-z
Jul 10 '12 #21

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: news.online.no | last post by:
In a query, I need too be able to show if a parent record has a child record. Using the query in a combo box too select record in a form. Thanks :)
25
by: Lyn | last post by:
Hi, I am working on a genealogy form. The only table (so far) lists everybody in the family, one record per person. Each record has an autonum ID. The parent form (frmMainForm) displays the...
0
by: Wolfgang Kreuzer | last post by:
Hi, I am starting to migrate an Access 2.0 application to Access 2000 (I know it's not the latest version, but ist supported in our company). I found some funny behaviours where I could not...
2
by: developer | last post by:
I have a form with a menu on the top. This menu show another form. I want to open this second form maximized inside the parent form just below the menu of the parent form. (Like Microsoft...
2
by: Mike L | last post by:
The child form can be dragged out of the Parent form. I set the child form to IsMdiContainer = False and the Parent Form IsMdiContainer = True. I also coded in the Parent Form on load, Dim f As...
3
by: cbrown | last post by:
I have two forms Main & Child. Main has several readonly properties that I would like to access from the child form. How do I reference the MDI-Parent form MAIN and use those properties.
0
by: kolalakitty | last post by:
Hopefully someone here can help me/point me in the right direction. I've found tons of references towards making relations, creating rows, saving said rows, using datagrids, databinding objects,...
2
by: dynamictiger | last post by:
I am building a wizard and have an issue with one sub form. Whilst all others are about 5 fields tall this one is 15 fields. My choices are either to resize the parent form ridiculously large for...
14
WyvsEyeView
by: WyvsEyeView | last post by:
On my form frmTopics (bound to table tblTopics), I've added a Copy button that copies the current topic record to create a new, identical one...simple enough. However, each topic record can have 1+...
1
Jerry Maiapu
by: Jerry Maiapu | last post by:
Hi Please help. How can I delete i single record in a datsheet subform from main form using a delete button on the parent form.? i will be more grateful for your help... jm
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.