Results 1 to 4 of 4

Thread: ms access delete records older than six months [Resolved]

Threaded View

  1. #1

    Thread Starter
    Frenzied Member wpearsall's Avatar
    Join Date
    Feb 2002
    Location
    England / UK
    Posts
    1,065

    Resolved ms access delete records older than six months [Resolved]

    ok, my database connection is working fine, can delete etc.

    need to mass delete tho, all records older than six months i wanna delete.

    pretty simple, except it isnt happening, im thinking problem wi me query.

    vb Code:
    1. Private Sub mnuFileClear_Click()
    2.    
    3.     If MsgBox("Are you sure you wish to delete old session data?" & vbCrLf & _
    4.               vbCrLf & "This will remove session data older than six months!", _
    5.               vbQuestion + vbYesNo + vbDefaultButton2) = vbNo Then Exit Sub
    6.              
    7.     Dim lRecCount As Long, sQuery As String
    8.        
    9.     sQuery = "DELETE FROM Visits WHERE sDate<" & _
    10.              FormatDateTime(DateAdd("m", -6, Now), vbShortDate) & _
    11.              ";"
    12.              
    13.              Debug.Print sQuery
    14.     ConnOBData.Execute sQuery, lRecCount
    15.    
    16.     Debug.Print lRecCount & " affected records!"
    17.    
    18. End Sub


    Quote Originally Posted by DEBUG
    DELETE FROM Visits WHERE sDate<09/09/2006;
    0 affected records!
    anyone spot the error? :S meh. i av got records wi the dates in march,april,may,june in 2005/2006 so should work? :S

    ta
    Last edited by Hack; Mar 9th, 2007 at 07:01 AM. Reason: Added green "resolved" checkmark Last edited by wpearsall : Today at 06:26 AM. Reason: Resolved
    Wayne

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width