473,387 Members | 1,485 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,387 software developers and data experts.

form with many to many relations

Hallo, I have a serious problem and I hope that you can help me.

I have a database with 2 tables that have a many to many relationship: the Journalist table and the Article table. These two tables are connected with a junction table, that is called Pulishing Year, that contains the two primary keys of the other 2 tables and an own primary key, the Publication Date.
I would like to do a form that contains all the journalists with a subform that contains all the articles that a journalist writes or have written.
The problem is that when I would like to enter a new article in the subform, access tells me that the field cannot be updated, but then it works and I can enter a new article. But it is wrong. I don't understand why access tells me this error. Then I would like that all the articles in the subform can't be modified or deleted, but I can enter new articles. Is this possilble?
I have to do this work for university, so its important and I hope that someone can help me, also only for one question.
How should I manage this problem of form and subform of many to many relations? and how can I lock the inserted articles, so that I can't modify or delete the data, but I can enter new articles?

THank you!!!!!!
Jan 6 '10 #1
9 2844
nico5038
3,080 Expert 2GB
The simples solution is to use a main form and two "nested" subforms, all based on the corresponding table:
1) Journalist
2) sub -> Pulishing Year
3) sub -> sub -> Article

Access will propose a "link key" you can accept.

This will give the possibility to add in the "sub-sub" form new articles without a problem.

Nic;o)
Jan 6 '10 #2
Thanks, but I have to ask you how I can create a subform in a subform. And how I can link them together? Is it possible for a many to many relationship with a junction table?
Thank you
Jan 6 '10 #3
NeoPa
32,556 Expert Mod 16PB
@Manudega
There are a number of ways. The way you choose will depend on exactly what you want (which you haven't explained).
  1. If you only want to see new records, then set the Data Entry property of your form to Yes.
  2. If you want to be able to browse other records without updating them, then you could add some code in the OnOpen & OnCurrent event procedures that set the form (or the various controls if you prefer) to locked or not depending on Me.NewRecord value.

PS. I assume when you say Pulishing Year you really mean [Publishing Year].
Jan 6 '10 #4
nico5038
3,080 Expert 2GB
To create a subform in another subform, just activate a control in the subform (to make sure it's having the focus) and use the Toolbar to add a subform.

When the table has been selected for the subform Access will propose the linkage fields and these can be accepted to have Access filter the sub (and sub-sub) form for showing only the records that are belonging to the "master" table.
I normally use the relationships window to join the tables and to "guide" Access to propose the proper linkage fields. Just check that window and try to add your tables and their relationships.

A many to many (N:M) relation table is the way to make sure that one article can be created by multiple Journalists. But when using the sub / sub-sub construction you'll always add an article to one Journalist. Making it a multiple Journalist article will need an additional action on the sub form (or a separate form) to add a record for that additional Journalist.

Nic;o)
Jan 6 '10 #5
Ok thanks now it works and the error doesn't anymore appear.
But now I have a last problem. I would like that the journalist form remains unchanged, in other words that the data could be changed, deleted or added, but I want my subform: that I can't modify or delete the already entered articles, but I should be able to enter new data...
How can I do this? When I modifiy Allowadditions and so on on the property sheet of the form, also the main form changes, but I want these options only for the subform.
Can you help me please????? :-)
Jan 7 '10 #6
nico5038
3,080 Expert 2GB
The easy way is to open the subform from the forms section "straight away" and te the properties.
The other way is to select the subform on the main form and make sure that the small square top left is clicked and holds a small black square to indicate that the form itself has been selected. The properties window will display the properties of that form.

Nic;o)
Jan 7 '10 #7
NeoPa
32,556 Expert Mod 16PB
See my post #4 and make sure to apply this to the form that is contained within your subform control (Nico has provided more specific instructions on how to do this). From your description I expect you require the second option.
Jan 7 '10 #8
OK thanks, excellent work.
Now my database works as I wanted.
Thank you and happy new year!!! Bye
Jan 7 '10 #9
NeoPa
32,556 Expert Mod 16PB
Very pleased we could be of help.

Happy New Year to you and Welcome to Bytes!.
Jan 7 '10 #10

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

Similar topics

2
by: Keith | last post by:
I am having a problem creating a many-to-many-to-many type relationship. It works fine, but when I create a view to query it and test it, it does not generate the results I expected. Below...
14
by: Sharon | last post by:
I have two tables in the DataSet, the first present rooms and the other furniture kinds. Furniture kind, like chare, can be in more then one room. And specific room can contain more then one...
1
by: SR | last post by:
Plz Help I have a dataset which has tables area,goals,objectives,tactics each area can have many goals,each goal can have many objectives,each objectives can have many tactics they are...
1
by: Charlie | last post by:
Hi: I need to display customer data and their associated purchase items on a web page. I guess the best idea is to pull data into an hierarchial dataset. After that, what control is best to use...
17
by: Barret Bonden | last post by:
As an old programmer just now looking at VB.net I have a question: How does one simply open one form from another ? I don't mean how does one create a new instance of that form , but rather how...
4
by: Jan Nielsen | last post by:
Hi all I'm a former Access developer who would like to implement a many-to-many relation in about the same way you do in Access: With a subform and a combo box. Is it possible to use a...
1
by: faiyeah | last post by:
Here is my database design: Entity ------ Publisher(, PubName) Author(, AuName) Sale(, Price, UnitOnHand) Book(, Title, BkType, PubCode)
3
by: john | last post by:
I have a form with Members and in that form a subform with Transactions. Those are linked (on banknr) 1xM which I've set in the database relations. Now I would like to copy the form and modify it....
0
by: drhoades66 | last post by:
I have books, authors and a bkauthlink table linking the other two tables-a many-to-many relationship. I have tried various things but cannot create a Data Relation. Is there no way to do this in...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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...

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.