具有多个子表单和/或查询的表单 [英] Forms with multiple subforms and/or Queries
问题描述
你好
我是一个很新的访问,并且遇到了设计一个小应用程序的问题。我有3个表,我从一个表与字段链接: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
我现在好了蚂蚁展示:
客户,然后是员工,然后是建筑工地,这适用于每个客户和每个员工。一个客户可以拥有许多员工和许多站点。
我可能可以链接:客户1-M员工1-M网站,但我不想这样做,因为我认为这是更好地让客户拥有对员工和网站的所有权。
任何有关如何获得这方面的帮助将不胜感激。
Yours Terje Moe
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
推荐答案
你并没有完全问一个问题,所以它有点难以回答,但我猜测它的员工与网站的多对多关系让你难以理解。以下是我看到的关系:
客户1-M网站
客户1-M员工
雇员MM网站
要建立MM关系,你需要制作一个单独的表格。我在我的关系表前面加上rel,所以表名是(对我来说):
relTbl_SitesEmp
这个表将包含2个字段:conConstructionSitesID,empEmployeesID
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
@TheSmileyOne
你好
谢谢你!
我会尝试这个,但是一个Q,你说两个字段,你是两个字段pluss relTbl_SitesEmpID吗?
你的Terje Moe
@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
您不需要此表的唯一ID。您可以将主键设置为2个字段的组合,并且该组合将始终是唯一的(因为工作者只能在同一站点上工作一次)。
如果您不知道如何:
如果您在设计视图中选择这两个字段,并点击主键按钮,访问将两个字段的组合作为主键。
欢迎来到字节
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
这篇关于具有多个子表单和/或查询的表单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!