473,387 Members | 1,379 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.

Forms with multiple subforms and/or Queries

7
Hello
I’m fairly new to access, and have run into a problem with designing a small app. I have 3 tables that I have linked from one table with field: cusCustomersID
tblCustomers
cusCustomersID
cusCustomersName
cusCustomersAddress
cusCustomersPostalCode
cusCustomersCity
cusCustomersContact
cusCustomersPhone
cusCustomersE-mail

tblEmployees
empEmployeesID
empCustomersID
empEmployeesFirstname
empEmployeesLastname
empEmployeesAddress
empEmployeesPostalCode
empEmployeesCity
empEmployeesPhone
empEmployeesE-mail
empEmployeesTitle

tblConstructionSites
conConstructionSitesID
conCustomersID
conConstructionSitesAddress
conConstructionSitesPostalcode
conConstructionSitesCity
conConstructionSitesPhone
conConstructionSitesE-mail

I now want to show:
Customers, then Employees, then Construction sites, this for each Customers and each employee. One customer can have many employees and many sites.

I probably could link: customers 1-M employees 1-M sites, but I don’t want to do that because I think it’s better to let customers have the ownership to the employee and the sites.

Any help on how to this would be appreciated.
Yours Terje Moe
Apr 17 '10 #1

✓ answered by TheSmileyCoder

You didn't exactly ask a question so its kinda hard to answer, but im guessing its the many to many relation of the Employees to Sites that got you stumped. Here is the relations as I see them:

Customers 1-M Sites
Customers 1-M Employes
Employes M-M Sites

To make a M-M relation you need to make a seperate table. I prefix my relationship tables with rel so the table name would be (for me) :
relTbl_SitesEmp
This table would then contain 2 fields: conConstructionSitesID, empEmployeesID

10 2369
TheSmileyCoder
2,322 Expert Mod 2GB
You didn't exactly ask a question so its kinda hard to answer, but im guessing its the many to many relation of the Employees to Sites that got you stumped. Here is the relations as I see them:

Customers 1-M Sites
Customers 1-M Employes
Employes M-M Sites

To make a M-M relation you need to make a seperate table. I prefix my relationship tables with rel so the table name would be (for me) :
relTbl_SitesEmp
This table would then contain 2 fields: conConstructionSitesID, empEmployeesID
Apr 17 '10 #2
temo
7
@TheSmileyOne
Hello

Thank you for this!

I will try this out, but one Q, you say two fields, do you meen two fields pluss relTbl_SitesEmpID?

Yours Terje Moe
Apr 17 '10 #3
TheSmileyCoder
2,322 Expert Mod 2GB
You dont need a unique ID for this table. You can set the primary Key to be the combination of the 2 fields, and that combination will always be unique (Since a worker can only work once on the same site).

In case you don't know how:
If you select both fields in design view, and hit the primary Key button, Access will make the combination of the 2 fields the primary key.

And welcome to Bytes
Apr 17 '10 #4
temo
7
Ok

I'm not so fam. with makeing a linking table, but I think I can do this.

I see you are from Denmark, I'm from Norway, so I guess we both are stranded for some days, but at least we can drive!

Thank you again.
Apr 17 '10 #5
TheSmileyCoder
2,322 Expert Mod 2GB
Well I wasn't planning on going anywhere myself, but a friend of mine was going to visit from Greenland, but had to cancel :(

The linking table can take a bit getting used to the first few times, but its quite powerfull (and the only way you can make Many-Many relations)
Apr 17 '10 #6
temo
7
Hello again.

I didn’t quite get this to work.

First of all I don’t seem able to make a many too many rel. As the submitted photo “Relasjoner” shows, Access only let me make 1-M rel. between the tree tables on the right.

As the photo “Cus_Con_Emp” shows I have made a form with two sub forms. Mainform handles Customers, upper subform handles Constructionsites and the lower form handles Employees. They are linked: cusCustomersID-conCustomersID and frmLinConstructionSitesDelskjema].Form![conConstructionSitesID]-linConstructionSitesID

When I navigate the main form, the subform shows correct, but when I navigate the upper subform the lover sumform do not follow.

I can add one or many new sites, but I cannot allocate workers to the new site.

I can though do this manually in the tables and it then show up correct in the nested forms.

Any help on this matter?
Attached Images
File Type: jpg Cus_Con_Emp.jpg (17.7 KB, 188 views)
File Type: jpg RelasjonerStor.jpg (15.0 KB, 194 views)
Apr 18 '10 #7
temo
7
Sorry, but I don't know why the photos turn out so bad, when I post them, they are approximately 300 bytes etch
Apr 18 '10 #8
TheSmileyCoder
2,322 Expert Mod 2GB
I don't know about the pictures. I have experienced similar issues myself. I just try to edit them in Paint so they are as small as possible before posting them.

What I can see from your picture is that you have all the relations defined at the same time, I.e. they must all be fullfilled simultaneously.

What you need to do, is first take your customers, employes and sites tables. Define the relation between customers and sites, and between customers and employes.

Now add the Sites table and employes table again, think access names them "tblEmployees_1" and "tbl_ConstructionSites_1". Now add your relTbl_SitesEmpl table, and define the relation between relTbl_SitesEmpl and tbl_Employees_1 and tbl_ConstructionSites_1.

Now I have noticed that sometimes access will rearrange your relations if you close and open the relations window, Thats not a problem, im just saying so you dont wonder whats happening, I guess its access way of making the relations in the smartest way.
Apr 19 '10 #9
temo
7
Hello

Thank you again, I will try this.
Apr 19 '10 #10
temo
7
Hello

Thank you again, I got this working now

Yours
Terje Moe
May 4 '10 #11

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

Similar topics

1
by: John Mudd | last post by:
I come from the Access environment where all the windows form handles were hidden so pardon my question. In Access I could make "continuous" subforms and there was a subform "container" object I...
2
by: Dee | last post by:
I have a form which contains basics of a customer's order from table . I placed a tab control on this form which is still empty. I'm trying to design a project management database and would like...
3
by: godber | last post by:
I am having difficulty in adding a subform into my existing form, I have designed very simply databases in the past & this is my first attempt at compiling subforms - with little success I may add....
2
by: Jonathan LaRosa | last post by:
Hi all - I'm wondering if anyone has (or knows of) a tool that will allow me to search through VB code, tables, queries, reports, forms, and other objects, for references to all other types of...
1
by: chris vettese | last post by:
I'm looking for advice on how to perform calculations on my forms. Iwill try to explain the situation as clearly as possible. I have a form that has multiple sub-forms. Some of these sub-forms...
4
by: Luisa Lopes | last post by:
Dear colleagues: I read somewhere that you could obtain the results of a query as a form. I have design a database for my books and waht I would like is to obtain the results of my queries...
3
by: WimKoene | last post by:
Hi, I am new to this forum and also a learner for access and have a question for the access experts. I've build a small access database containing personnel details. I have created several...
1
by: natwong | last post by:
Hi All, I'm hoping that someone could help me out since I'm new with Access. Background: Database was set up as a simple data entry and reporting tool for Program Initiatives. The data...
10
Megalog
by: Megalog | last post by:
Hello all! This is my first posting here, although I've been lurking here for months and getting lots of help & tips from the past posts here. I'm in the process of updating our company's Access...
0
by: TD | last post by:
I have a main form with two subforms (both in datasheet view), neither of which are linked to the main form. The main form is based on a query that uses the bound column of a combobox on the main...
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
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...
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
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
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...

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.