Results 1 to 8 of 8
  1. #1
    SmartestIdiot is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Dec 2013
    Posts
    27

    Auto Delete Record on Date in Field

    Hello Everyone,

    I have a database of personnel. People come and go all the time; however I can't have a personnel record deleted as soon as they leave. They remain on our books until a specified date for each individual. The date is different for each individual. I was hoping to have a field in their record with the date, and have a query or some code delete that record on the date in the field. Is this possible? Thanks.

  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
    53,623
    It is, but why bother with delete? Deleting records should be a rare event. Just after you delete, a reason to visit that record will come up - guaranteed. Just filter out the records with a 'terminated' date.
    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
    Demerit's Avatar
    Demerit is offline Competent Performer
    Windows 7 32bit Access 2007
    Join Date
    Nov 2013
    Posts
    125
    Quote Originally Posted by June7 View Post
    but why bother with delete? Deleting records should be a rare event. Just after you delete, a reason to visit that record will come up - guaranteed. Just filter out the records with a 'terminated' date.
    Actually a Database should have data in it such that future analysis could be done on it. Lets assume we are in the year 2020, you may want to do a historical annual analysis on the number of people who have come and gone since 2013 to 2020. how will you do that if you have been deleting the data. What ever the case, deleting data should be the last thing you should do.

    As a matter of fact, there is always enough space to store the data. Hope you see reason in this?

  4. #4
    SmartestIdiot is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Dec 2013
    Posts
    27
    Ok. I'm on board with the whole idea of archiving the information to different table or sort, but how do I get it off of the current table and moved automatically based off of a variable date for each record?

  5. #5
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,623
    There is no reason to 'move' records to a different table. Filter queries to exclude the records that have a date in the 'terminated' field.
    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.

  6. #6
    SmartestIdiot is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Dec 2013
    Posts
    27
    Ok, I know how to query for records with a terminate date. My question is how to I have my queries and reports begin to stop showing the records after the terminate. Keep in mind. Each record will have a different terminate date. So when personnel leave the organization I would have the terminate date entered in possibly a week or even a month out. I'd like them to stay on our books until that date rolls around. At that time they would drop off.

  7. #7
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,623
    Try:

    SELECT * FROM table WHERE [terminated] Is Null;

    Or

    SELECT * FROM table WHERE [terminated] Is Null Or [terminated] > Date();
    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.

  8. #8
    SmartestIdiot is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Dec 2013
    Posts
    27
    Thanks June7. Looks like that will work. I'll give it a shot and repost.

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

Similar Threads

  1. Replies: 3
    Last Post: 12-24-2013, 04:20 PM
  2. Lock field after auto date fill
    By DCV0204 in forum Forms
    Replies: 4
    Last Post: 11-25-2013, 08:53 AM
  3. Auto update of date field
    By ase33592 in forum Forms
    Replies: 1
    Last Post: 08-05-2013, 02:32 PM
  4. Replies: 7
    Last Post: 08-16-2012, 02:16 PM
  5. Auto Delete record after 3 years?
    By maxx102 in forum Access
    Replies: 3
    Last Post: 06-01-2012, 08:55 PM

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