473,511 Members | 14,134 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

LinkMasterFields property in subform of subform

12 New Member
Hello,

I've read through many forum posts on this issue today but can't seem to find a solution that fits my particular case.

I have three main tables:
- tblIssues (PK: IssueID)
- tblRecommendations (PK: RecommendationID)
- tblActions (PK: ActionID)

There is a many-to-many relationship between issues and recommendations and between recommendations and actions. I have implemented join tables between them to account for this relationship.

I have a main form, frmIssues, that has a subform, sfrmRecommendations (based on qryIssueRecommendation). I'm able to use these forms to view AND enter issues and recommendations... the linkMasterFields and linkChildFields (both set to "IssueID") properties are working correctly.

I'm trying to create a subform, sfrmActions (based on qryRecommendationAction), of sfrmRecommendations. To be clear: sfrmActions is a subform of sfrmRecommendations, which is a sfrm of frmIssues. The form accurately displays the actions for a given recommendation, but when I try to enter a new action I get the following error: The LinkMasterFields property setting has produced this error: 'The object doesn't contain the Automation object Recommendations."

I have tried using various versions of RecommendationID in the LinkMasterField property, including [RecommendationID], Recommendations.RecommendationID, and [Recommendations.RecommendationID].

I think the error has something to do with RecommendationID not existing on the main form (frmIssues). I've seen posts that suggest putting a hidden textbox on the main form with the control I need, but so far I haven't found a way to add RecommendationID to frmIssues.

Any suggestions?
Jun 30 '08 #1
7 3516
Stewart Ross
2,545 Recognized Expert Moderator Specialist
Hi. Could you post the SQL for the queries involved? I am not clear from what you have said about your linking tables, as you have not posted any detail on these.

If there are two many-many relationships, each decomposed into two 1-many relationships by use of a link table, then the link tables will have the fields from both tables in the relationship carried forward. That is, if T1 relates many to many to T2 then link table T3 will have a composite key, T1PK and T2PK. Similarly for your other table.

If the relationships are defined in this way I would be surprised if you had single-key parent-child links from your main forms to your subforms throughout the multiple-level hierarchical relationship you describe; you would not be carrying forward the linking key from at least one table if not more. Can't tell without more detail, though.

I would also point out that users will quickly become lost if you nest subforms several levels deep as you seem to be suggesting. My preference would be to open a separate main-form/sub-form dialogue filtered from your other form to avoid too many levels of hierarchy for users to negotiate - it's going to get awfully crowded on screen trying to fit in a main form for data entry, a sub form, and a sub-sub form etc.

-Stewart
Jul 1 '08 #2
jgoodnight
12 New Member
Hi Stewart,

The linking tables contain three fields: An autonumber PK and the 2 PKs of the tables it is joining.

The SQL for the IssueRecommendation query is:
Expand|Select|Wrap|Line Numbers
  1. SELECT Recommendations.RecommendationID, Recommendations.Title, Recommendations.Description, Recommendations.Source, Recommendations.Date, Recommendations.Status, Recommendations.Background, Recommendations.POC, [IssueRecommendation Join].IssueID, [IssueRecommendation Join].RecommendationID, Issues.Title, Issues.Description, Issues.POC
  2. FROM Recommendations INNER JOIN (Issues INNER JOIN [IssueRecommendation Join] ON Issues.IssueID = [IssueRecommendation Join].IssueID) ON Recommendations.RecommendationID = [IssueRecommendation Join].RecommendationID;
The SQL for the RecommendationAction query is:
Expand|Select|Wrap|Line Numbers
  1. SELECT [RecommendationAction Join].RecommendationID, Actions.Title, Actions.Description, Actions.Background, Actions.Agency, Actions.POC, Actions.[Begin Date], Actions.[End Date]
  2. FROM Recommendations INNER JOIN (Actions INNER JOIN [RecommendationAction Join] ON Actions.ActionID = [RecommendationAction Join].ActionID) ON Recommendations.RecommendationID = [RecommendationAction Join].RecommendationID;
You are correct in that this is starting to look confusing... I've been trying to combat that with label formatting but am open to other design ideas. I'll read up on filtering.
Jul 1 '08 #3
Stewart Ross
2,545 Recognized Expert Moderator Specialist
Hmm. I'm sorry to say that I there is conflicting information in what you have mentioned so far that makes it very difficult for me to advise you further.

If, as you said in post #1, the relationship between Issue and Recommendation is m-m, and between Recommendation and Action is m-m, then the link tables are essential to decompose your two many-many relationships into workable 1-m's. If you want to implement a form for users to add recommendations and issues the linking parent-child fields cannot be just IssueID if the relationship between Issue and Recommendation really is m-m. I am using the word cannot because otherwise you would violate referential integrity by doing so, and I am sure that Access would object when you try to enforce the relationship (assuming as good practice you do use the relational facilities built in).

By definition, if the relationship between tables T1 and T2 is m-m then there is no guaranteed single unique row in T1 for each T2 - and equally, there is no guranteed unique single row in T2 for each T1. Relational databases cannot implement such an m-m relationship directly - that is what the decomposition into two 1-m's resolves, as you have done. However, in your main-form/sub-form you are implementing a link to T2 through the PK of T1 - which does not implement the decomposed relationship with the link tables you have defined. It is implementing a 1-m relationship instead - which means that you would not be able to use your form to show all T2 rows belonging to multiple T1s as it stands. Main/Subform combinations are intended for 1-m relationships - and from what you have said this is not such a relationship.

In post #3 you mention the two queries which join the issues and actions to their respective link tables. Although you are trying to use these joining queries, the sequence of events does not match: the linking table can only link an existing record on each side of the relationship (an existing action to an existing recommendation). I am not surprised as it stands you cannot add an action record using the linking query - so far as I can see you cannot add such a record using that query, although you will be able to show records that already exist.

Too many conflicting things going on here; but of one thing I am certain - either the relationship between your Issues and Recommendations and Recommendations and Actions tables are incorrectly defined as m-m, or you have not implemented the relationship as anything other than 1-m in each case. The relationships cannot simultaneously be 1-m the way you are carring the PK forward in your subforms and m-m decomposed using linking tables.

-Stewart
Jul 1 '08 #4
jgoodnight
12 New Member
Stewart,

Thanks for taking so much time to consider my problem. Your insight led me to the realization that the implementation I thought was working didn't actually get the job done.

The overall goal is to allow the user to enter an issue, select recommendations to solve the issue (or enter a new recommendation if need be), and select actions supporting that recommendation (or enter a new action if need be).

I've refined the tables/relationships to the following:

tblIssues
PK IssueID
Title
Desc
etc.

tblRecommendations
PK RecommendationID
Title
Desc.
etc.

tblActions
PK ActionID
Title
Desc.
etc.

tblIssueRecommendation Join
PK IssueID, RecommendationID

tblRecommendationAction Join
PK RecommendationID, ActionID

I'll never enter a recommendation without having an issue to relate it to (or an action without having a recommendation to relate it to), so I thought it made sense for my form to start with Issues and drill down from there. Is this a possibility? Are there other possible ways to manage this data?

I'm new to this forum and to Access programming (as I'm sure is apparent), so if this is not the right place for this question please let me know.

Thanks again for your time,

Jonathan
Jul 1 '08 #5
Stewart Ross
2,545 Recognized Expert Moderator Specialist
Hi Jonathan. All database design involves judgment about the relations between tables; practical implementations often involve conscious compromises, such as (for example) recognising that although a relationship may be m-m in the worst case (a recommendation may can cover many issues, and each issue can have many recommendations) in practice single issues may most often be involved, so a 1-m approach would be justified - and much easier to implement. I mention this because your revised design still implements the relations involved as m-m, and implementing this as two 1-m's is likely to be a challenge for you.

To implement your current m-m decomposed to two 1-m relations you would most likely need to have an issues entry form and a recommendations entry form, then a main/subform combination to select which issue links to which recommendation (and vice versa). Although not difficult to implement, this does not 'feel' right to me (thinking about what a user would intuitively do). Perhaps a 1-m approach is a better compromise - but with the limitation that recommendations would never apply to any more than one specific issue. Such an approach would allow a more intuitive use of a main/subform combination to enter issues and recommendations, then another to enter actions associated with those recommendations.

Please feel free to bounce your thoughts about this here; design is more of an art than a science when it comes to decisions about relationships between tables at this level.

-Stewart
Jul 2 '08 #6
NeoPa
32,557 Recognized Expert Moderator MVP
Just to clarify Jonathan, is the table [tblRecommendations] referred to in your explanatory posts the same object as the [Recommendations] as used in the SQL posted, or is there something I'm missing here (I hope not)?

Other than this strange anomaly, it seems that you're getting to grips with some of these concepts quite well for a beginner.

Welcome to Bytes :)
Jul 3 '08 #7
jgoodnight
12 New Member
Hi Neo and Stewart,

Neo - Thanks for the kind words. Yes, I was using the "tbl" in front of all the table names as I thought that was the generally accepted way of referring to tables in forums like this. The actual table names do not have the "tbl" included.

Stewart - I started over using a 1-m relationship between Issues and Recommendation and between Recommendations and Actions. Everything is working out well! Thanks again for your help.
Jul 11 '08 #8

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

Similar topics

1
1962
by: Filips Benoit | last post by:
Dear All, W2000 Office2000 Access adp SQLserver DB Problem: Adding a new property for a company in the subform. The FIRST time I Select a property in combobox CPROP_PRP_ID the subform act
4
1650
by: Mr. Bungle | last post by:
Just when I thought I knew everything... Does anyone know why sometimes when creating a subform, the RecodSource property is totally unavailable, this appears to happen when you don't use the...
0
1350
by: Filips Benoit | last post by:
Dear All, W2000 Office2000 Access adp SQLserver DB Problem: Adding a new property for a company in the subform. The FIRST time I Select a property in combobox CPROP_PRP_ID the subform act
6
12071
by: Mindy | last post by:
Hey, I am using SetValue to change the DataEntry property of a form to "YES". But It doesn't work. No error messages, but the property didn't change.Following is the what I am writing SetValue:...
3
3323
by: jaLe | last post by:
This problem was discussed before but it doesn't solve my situation I have master table Generalije with PK: ID1 I added subdatasheet table Nalaz with field FK GeneralijeID When I add new...
1
2622
by: Liveson | last post by:
Hie I have an unbound form on which there are 3 controls: option group, combo box and a subform. The value of the combo box depends on the value of the option group and the value of link child...
1
1753
geolemon
by: geolemon | last post by:
I have a form/subform used for inventory management. It is a bound form. The error: I don't understand what this means. How the form is intended to work: When you select a part number in...
17
6043
by: eranil84 | last post by:
I get this "The LinkMasterFields Property setting has produced this error: 'A problem occurred while Microsoft Office Access was communicating with the OLE server or ActiveX Control' " error message...
3
3233
EJaques
by: EJaques | last post by:
Hello, I have a list box that controls the display of information on a form and its subform. I am having problems with the code to change Child/Parent links according to what is selected in the...
0
7237
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7137
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
7349
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,...
1
7074
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
7506
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...
0
5659
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5063
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3219
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
445
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.