表关系 [英] Table relationships

查看:74
本文介绍了表关系的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好


我现在已经在这个项目上工作了4个月,并且仍然是第一步。这让我自杀。


作为测试数据库,我设置了以下内容:


表1(客户):


ClientID

Firtsname

姓氏

HouseNumber

街道名称

Town

邮政编码

HomePhone

MobileNumber

电子邮件


Tabel 2(治疗方法):


TreatmentID

治疗

费用

日期

现在我不确定如何关联这些表格。我还想设置一个选项卡表单,在第一页上只输入新的客户端详细信息,然后在第二页输入现有客户的任何处理。现在,您如何将特定治疗与客户联系起来?


4个月后我应该知道如何做到这一点,但我想我已经陷入了这样一个混乱我不知道离开了从右边加上我们刚刚升级到Access 2007.


感谢您的任何建议。

Hi all

I have been working on this project now for 4 months and is still no further than the first step. This is driving me to suicide.

As a testing database I have set up the following:

Table 1(Clients) :

ClientID
Firtsname
Lastname
HouseNumber
Streetname
Town
Postcode
HomePhone
MobileNumber
Email

Tabel 2(Treatments) :

TreatmentID
Treatment
Cost
Date

Now I am not sure how to relate these tables . I also want to set up a tabbed form and on the first page only enter new client details but then on the second enter any treatments for existing clients. Now how do you link a specific treatment to a client?

After 4 months I should know how to do this, but I think I have gotten myself into such a muddle I dont know left from right and plus we have just upgraded to Access 2007.

Thanks for any advice.

推荐答案


大家好


我现在已经在这个项目上工作了4个月,现在仍然是第一步。这让我自杀。


作为测试数据库,我设置了以下内容:


表1(客户):


ClientID

Firtsname

姓氏

HouseNumber

街道名称

Town

邮政编码

HomePhone

MobileNumber

电子邮件


Tabel 2(治疗方法):


TreatmentID

治疗

费用

日期

现在我不确定如何关联这些表格。我还想设置一个选项卡表单,在第一页上只输入新的客户端详细信息,然后在第二页输入现有客户的任何处理。现在,您如何将特定治疗与客户联系起来?


4个月后我应该知道如何做到这一点,但我想我已经陷入了这样一个混乱我不知道离开了从右边加上我们刚刚升级到Access 2007.


感谢任何建议。
Hi all

I have been working on this project now for 4 months and is still no further than the first step. This is driving me to suicide.

As a testing database I have set up the following:

Table 1(Clients) :

ClientID
Firtsname
Lastname
HouseNumber
Streetname
Town
Postcode
HomePhone
MobileNumber
Email

Tabel 2(Treatments) :

TreatmentID
Treatment
Cost
Date

Now I am not sure how to relate these tables . I also want to set up a tabbed form and on the first page only enter new client details but then on the second enter any treatments for existing clients. Now how do you link a specific treatment to a client?

After 4 months I should know how to do this, but I think I have gotten myself into such a muddle I dont know left from right and plus we have just upgraded to Access 2007.

Thanks for any advice.



您的治疗表需要具有Client表的外键,如下所示:


Tabel 2(治疗):


TreatmentID

ClientID(引用客户表的主键的外键)

待遇

费用

日期


在查看本教程时值得你:

规范化和表格结构


你好


谢谢你的回复。对不起,我忘了提到我在处理表中将客户端ID作为外键包含在内。我还想过在某种程度上使用链接表,但我认为这是错误的。治疗和价格也将被查找,因为它们很少会改变。


但我会看一下你在回复中包含的链接。


非常感谢
Hi there

Thank you for reply. Yes sorry, I forgot to mention that I included the Client ID as a foreign key in the Treatments table. I also thought at one point of using a linking table instead, but I suppose that will be wrong. Also the Treatments and Prices will be lookups as they would rarely change.

But I will have a look at that link you included in the reply.

Thanks a lot



你好


谢谢你的回复。对不起,我忘了提到我在处理表中将客户端ID作为外键包含在内。我还想过在某种程度上使用链接表,但我认为这是错误的。治疗和价格也将被查找,因为它们很少会改变。


但我会看一下你在回复中包含的链接。


非常感谢
Hi there

Thank you for reply. Yes sorry, I forgot to mention that I included the Client ID as a foreign key in the Treatments table. I also thought at one point of using a linking table instead, but I suppose that will be wrong. Also the Treatments and Prices will be lookups as they would rarely change.

But I will have a look at that link you included in the reply.

Thanks a lot



如果你有ClientID。将索引属性设置为是(重复确定)。然后打开关系窗口并双击关系并勾选所有参照完整性和级联选项。


在选项卡表单上。将主窗体的记录源设置为clients表,并将字段控件放在第一页选项卡上。在第二页选项卡上,根据处理表放置子表单,并使用主/子属性链接ClientID字段。


Mary

If you have the ClientID in. Set the indexed property to Yes (Duplicates OK). Then open the relationships window and double click on the relations and tick all the referential integrity and cascading options.

On the tabbed form. Set the record source of the main form to clients table and put field controls on first page tab. On second page tab put subform based on treatments table and use master/child properties to link the ClientID fields.

Mary


这篇关于表关系的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆