473,406 Members | 2,356 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,406 software developers and data experts.

many to many relationship

hi,
i'm having a problem on my many to many database. It has 3 tables: "suppliers", "service(s) offered" and a linking table "supplier/service".
I created a form to display detailed information about each supplier and a subform to show which service(s) are offered by each supplier (because a service can have more than one supplier and a supplier can offer more than one service).
However a lot of companies have different departments for which kind of service offered and then different information about contacts, emails, etc.
Any help about how can i display different information on the form fields when i select the different services offered by one supplier?
Thank you a lot.
Jan 9 '12 #1
8 1350
sierra7
446 Expert 256MB
Hi
At first glance it sounds like you need a new table, say "departments" which will be in the many-to-many construct (replacing"suppliers"), relegating the current "suppliers" to be a look-up via a SupplierID code.

Personally, I am not happy about your present choice of table names. They are probably 'legal' but if you are just starting your design I would avoid backslashes, brackets and spaces. The convention is to prefix tables with 'tbl' but there are many variations (tbl_, tbl__ etc)

I've attached a tentative entity diagram.
S7

Attached Images
File Type: jpg Entities.jpg (17.3 KB, 176 views)
Jan 9 '12 #2
sierra7 thank you for reply.
i already changed my table names as you suggested.
regarding the problem, i don't make it clear.
what i want to know is about the possibility of creating different forms for the same supplier if it supplies more than 1 service.
for example, a cleaning company can offer their services for cleaning floors and for cleaning specific machines. although the business is the same, the chiefs operators can be different and so their contacts. when it happens i need to somehow have 2 different forms with the specific contact field answers for the different services i'm looking for information (of the same supplier).
in the picture we can see a supplier form that supplies two kind of services ("Limpeza dos Sistemas de Extração" and "recolha de RSU").[IMG]C:\Documents and Settings\jffelix\Desktop[/IMG]
thank you!
Jan 9 '12 #3
sierra7,
Don't bother with the preview question i made..
Can you just explain me how could i solve my problem with the suggested solution?
when i finished to design the tables how do i make the form display different information for the same supplier regarding different departments?
thank you.
Jan 9 '12 #4
Rabbit
12,516 Expert Mod 8TB
That's what S7's design allows for.
Jan 9 '12 #5
sierra7
446 Expert 256MB
Sorry for the delay. I've attached a demo system that you will have to unzip.

I will talk this through tomorrow

S7
Attached Files
File Type: zip Services2003.zip (74.3 KB, 49 views)
Jan 10 '12 #6
S7,
thank you a lot, that's exactly what i'm trying to do.
Do you think that is possible to compare records graphically BY SERVICE in parameters like price, total equipment, and so on? (other fields that i already added).
I tried that starting a new form, inserting a graph, choosing departments table and then "price", however it doesn't work because i can't choose price "none" and price "min" to make that comparison. So i'm thinking about a query looking for 1)"price" and 2)use "select min" function for "price" and then feed my graph with that query.
I need to try it to make sure that i can get specific graphs for each service.
Any different/easier suggestion?
Many thanks.
Jan 11 '12 #7
sierra7
446 Expert 256MB
OK, first I'll give a quick description of the system I posted yesterday.

The form frmSuppliers is basesd on tblSuppliers and has two sub-forms. The first is frm_SubDepartments, based on tblDepartments, and represents the one-to many aspect of the data. The second subform is frmServices, which is perhaps misleading because it is based on the joining table tblDept_Services, represents the one-to-many situation. The ServiceName is 'looked-up' via a combo-box bound to ServiceID.

The second sub-form is kept synchronised by the On_Current event in frm_SubDepartments by writing the DepartmentID to a hidden field on the parent form. While this arrangement does not meet your requirement of showing ALL the services offered by a Supplier, it does allow you to ADD a new Supplier, ADD his Departments and contact details, then PICK services for each Department and add Price and any other fields you may have added. The Services must be set-up prior.

Form frmDepartments maybe irrelevant; it's based on Departments and shows the Services available in a sub-form. New Departments can be ADDED to an existing Supplier but services must be predefined.

The form which probably most meets your needs is frmBrowse_Suppliers. This is based on Suppliers but the Subform is based on a query joining the Departments table with joining-table tblDept_Services. All of the services for a company are shown at the expense of repeating the Department data. I called this form 'Browse' because it has limited INPUT capabilities.

You may want to note how much of the data is entered via combo-boxes which use two columns with the first (bound) column hidden. This is to help insure that you are inserting on the right side pof the joins.

You have added some additional requirement which I will have to consider. The Moderators may split these off into different threads.
S7
Jan 11 '12 #8
sierra7
446 Expert 256MB
Hi,
My first reaction is that if you have your data structured correctly then you should be able to display anything that you want. That was the purpose of getting the input screens correct.

However, my second observation would be "don't start with a Graph!" First you must design your query that produces the numbers that you want to see in the graph. You seem to have some issues about zero cost and no-cost. I'm not clear why this is a problem but you need to resolve it. If you want to know the Supplier with the lowest price for a service, why not just list the prices in ascending order? (I can appreciate that a graph could additionally show frequency and spread etc.)

Note that my prices are on the 'join' table because that is the only point specific to both the Department and a Service. This is where other data such as total equipment' should be added.

Having said this it should be a simple matter to design a new form based on Service, then embed separate sub-forms (or graphs) for Price or Equipment. You just have to set-up your queries correctly.
S7
Jan 11 '12 #9

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

Similar topics

1
by: Mark Hargreaves | last post by:
Hopefully someone can help. I have two tables, namely master and postings: Fields include the following: master: staffno - int (11) primary key forename - varchar (20) surname - varchar...
3
by: Mikey | last post by:
Hi all. In the process of trying to figure this thing out, I've been doing the old "stand around in the store and read as much as possible before you look like a derelict" thing. This time, with...
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...
1
by: ning | last post by:
It's easy to present "One - Many" relationship in XML, but how to present "Many - Many" relationship in XML?
1
by: Powell | last post by:
I have a requirement to return some information from a large number of xml files I have tried XSLT, which quickly gets overwhelmed. Found references to XQuery and it seems like it might work I...
2
by: Todd D. Levy | last post by:
I have a primary table (containing basic contact information) and a number of subsidiary tables (containing various additional information) for employees. Most of the subsidiary tables have a...
4
by: JSMiami | last post by:
I have a form that is fed by a certain table. This table connects to an intermeddiate table and then a look up table. All of this is done to accomplish a many-to-many relationship. Imagine that the...
5
by: BrianDP | last post by:
This is a strange one-- I have an Access 2K database with a split front end/back end. There are two tables in the back end - RFile and RLine. There is a one to many relationship from...
2
by: The Frog | last post by:
Hello everyone, I am trying to find way of writing an SQL query that can produce missing record combinations across a many to many type setup in Access. The three tables used are as follows:...
0
by: fred.flintstone | last post by:
I get warnings in the windows event viewer every few seconds.. See below. Why is this ? Event Type: Warning Event Source: DB2-0 Event Category: None Event ID: 5 Date: 22/08/2007...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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
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
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...
0
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,...
0
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...

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.