Reference to composite primary key in Access 2007

后端 未结 2 978
Happy的楠姐
Happy的楠姐 2020-12-21 05:25

I have looked around and found some questions similar but they were for SQL Server instead.

Here is a small database structured I have create just to show you the re

相关标签:
2条回答
  • 2020-12-21 05:53

    Composite keys are of course helpful and solve your problems, but if you really want to avoid composite key joins, another alternate way of accomplishing what you require is to slightly re-design your table structure. As end reports are always sought based on month & year combination, it would help to have a MthYear dimension (or table). The following can be the entries in that table - with a yymm format:

    1301 1302 1303 ... ... ... 1312 1401 1402 ... ... etc....

    You can have further attributes in the same table in more descriptive form like second field could be Jan-13, Feb-13....etc.

    The MthYear field can be your primary field which can be connected to MthYear in your report maint table. This will not only avoid using composite primary keys but also help you to filter only year or month if you require using wildcard characters in your queries or reports. Hope this is helpful to you......Arvind

    0 讨论(0)
  • 2020-12-21 06:06

    Create the Year or Period relationship with Maintenance, then either double-click the relationship line to edit the relationship or drag the second part (year or period accordingly) to Maintenance and choose Yes when asked if you want to edit the relationship. You can now add the second line, like so:

    Relationship with two fields

    0 讨论(0)
提交回复
热议问题