Results 1 to 2 of 2
  1. #1
    Ragothlham is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2011
    Posts
    1

    Self-join and form issues

    Hello,



    I am completely stuck with one issue of a task, and it is driving me insane because the logic seems so simply, but I am lost as to how to make Access do what I want.

    Basically, I have an entity/table, Work, with has several fields. One of those fields is Work_Name, which contains the names of various jobs/services. This field will also contain "package" deals, which are made up of various combinations of the jobs/services in Work_Name. I also have a field that simply marks whether or not an observation in Work_Name is a package.

    I know this is an issue with self-join, and in the Relationships window, I have added a second copy of the Work table, and have created a third table for the relationship "CONTAINS." tbl.Contains has two foreign keys, "Package_Name" and "Service_Name", both of which refer to "Work_Name" in the Work table.

    I want to create a form based on Work where I can enter services and, if I am entering a package, use a subform to:

    1) Enter the package in Work, and
    2) Enter the package and its component parts/services into Contains.

    How do you get Access to know that Contains should only be populated/updated when you're adding something that is a package, but also enforce integrity in the sense that both the name of the package has to agree on both tables, and that the services listed as a part of the package have to exist in Work as well?

    Please help, driving myself insane.

    Thanks.

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,622
    I think you meant: This table will also contain "package" deals, which are made up of various combinations...

    I think it will be simpler if you also consider Purchases of only one Work item as a 'Package'. So tables and relationships would be:

    Purchases
    PurchaseID (primary key)
    ClientID (foreign key)
    PackageID (foreign key)
    ActualTime
    ScheduledDate

    Packages
    PackageID (primary key)
    PackageName
    CostPerHour

    WorkPackages
    WorkPackageID (primary key)
    PackageID (foreign key
    WorkID (foreign key)

    Work
    WorkID (primary key)
    Description

    The problem I see is the CostPerHour field. If you offer special pricing for 'packages' then need pricing in the Packages table. If you don't offer special pricing then why bother with 'packages'? Without 'packages', would do:

    Purchases
    PurchaseID (primary key)
    ClientID (foreign key)
    ActualTime
    ScheduledDate

    PurchaseDetails
    PurchaseDetailsID (primary key)
    PurchaseID (foreign key
    WorkID (foreign key)

    Work
    WorkID (primary key)
    CostPerHour
    Description
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Button and form Issues
    By rmohebian in forum Access
    Replies: 1
    Last Post: 03-01-2012, 06:23 PM
  2. Join issues on packaing cost query.
    By Saniphor in forum Queries
    Replies: 0
    Last Post: 04-28-2011, 07:13 AM
  3. Issues with Continues form
    By ducecoop in forum Access
    Replies: 3
    Last Post: 11-11-2010, 01:18 PM
  4. Setfocus Split Form Issues
    By cksm4 in forum Programming
    Replies: 6
    Last Post: 10-13-2010, 02:46 PM
  5. Help with multiple form issues
    By AKQTS in forum Forms
    Replies: 0
    Last Post: 08-18-2010, 07:57 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums