Results 1 to 3 of 3
  1. #1
    Canadiangal is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Sep 2009
    Posts
    81

    Append Query for Archiving


    I have a database with the following tables:

    DepartmentData
    Department
    DepartmentTitles
    Attendance
    Employees
    HR
    MeetingsClasses
    PatientTreatmentProgram
    Procedures

    I have a field called status that marks employees as non-employees. However, at certain times, I want to archive employees out (lets say they are terminated). When I do this, something strange happens. If an employee has 4 records in the servicedata table (They may have had 4 services, in this case a service can be a flu shot, health assessment, etc.) and 4 records in the Classdata table (They may have attended 4 different required continuing education classes), then it exports out 16 records (4 x 4). I understand this is happening because PatientTreatmentprogram and Classdata table have no relationship. A Cartesian Product I am told. Would I be better off creating separate archive tables and archiving the data back into separate tables? Any words of wisdom? And no I can't simply marked them as archived and leave them. That isn't what the departments heads have requested....

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,956
    Nothing strange at all about those results. That is to be expected when including multiple 'many' tables in a query.

    Department heads don't understand relational database.

    Why do the department heads even know how the data is structured? If the forms and reports filter out the 'inactive' records, the result is the same as 'archiving'. Archiving will give you endless headaches because of related records, especially with multiple 1-to-many relationships, as you are seeing. Duplicate 'archive' tables would be the only way and if the pk/fk fields are based on autonumber then would require very complex code to accomplish.
    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.

  3. #3
    Canadiangal is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Sep 2009
    Posts
    81
    The primary field that links the majority of the tables together is an auto number. Could I simply have the archived table be a number field, so that when it appends it just gives it the current auto number? I will give this a try and see what happens.

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

Similar Threads

  1. Assistance designing an archiving query
    By gm_lowery in forum Access
    Replies: 1
    Last Post: 06-14-2012, 01:57 PM
  2. Replies: 1
    Last Post: 10-06-2011, 08:37 AM
  3. Replies: 7
    Last Post: 07-21-2011, 01:01 PM
  4. Archiving records
    By NOTLguy in forum Access
    Replies: 3
    Last Post: 11-21-2010, 03:15 PM
  5. Archiving old records
    By dean in forum Access
    Replies: 7
    Last Post: 09-14-2009, 02:54 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