Results 1 to 2 of 2
  1. #1
    ui7598h is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2015
    Posts
    10

    Post Delete Query base on Min date value in field

    My field names in my table are PersNo, WS rule, Logdate, Start, Day assignment, TID


    I am attempting to build a query where entire records are deleted where the Day assignment field contains "Assignment to previous day", and the Log date field is the MIN date of all the records. See below. I need to have the record within the blue box removed. There are several of these records in the table.



    Please help!!!

    Steve

    Click image for larger version. 

Name:	3-18-2015 11-55-40 AM.jpg 
Views:	6 
Size:	265.3 KB 
ID:	20096

  2. #2
    Rawb is offline Expert
    Windows 7 64bit Access 2010 32bit
    Join Date
    Dec 2009
    Location
    Somewhere
    Posts
    875
    Generally, unless you're using a lookup Table, you shouldn't need (or want?) to delete Records from a database. I'd recommend adding a "Yes/No" Column to the Table. Then you can alter your Queries to only return Records where that value is True.

    That said...

    Code:
    DELETE 
    FROM MyTable 
    WHERE [Day assignment]="Assignment to previous day (set automatically)" 
      AND [LogDate]=(SELECT MIN(t_1.[LogDate]) As LogDateMin FROM MyTable AS t_1)
    The above Query should work if you change MyTable to the actual name of your Table.

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

Similar Threads

  1. Replies: 20
    Last Post: 01-13-2015, 02:23 PM
  2. Replies: 5
    Last Post: 10-19-2014, 06:29 PM
  3. Auto Delete Record on Date in Field
    By SmartestIdiot in forum Access
    Replies: 7
    Last Post: 01-04-2014, 08:54 AM
  4. get max srno base on date
    By waqas in forum Programming
    Replies: 3
    Last Post: 11-05-2011, 12:34 PM
  5. Replies: 3
    Last Post: 05-03-2011, 01:36 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