#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2013
    Posts
    5
    Rep Power
    0

    Deleting from a table when a date is greater than input


    Hello everybody, I'm using Access database, and I control it by using sql in vb.net.
    I have a date field in a table and I need to delete from that table where the field date is greater than the input date in the vb form.

    I tried using the datediff() and delete where the function retrieves negative value, but it tells me that I have missing arguments, I guess it's the time.

    The date field is DD/MM/YYYY. No time in it.

    Please help me in this query.
  2. #2
  3. SQL Consultant
    Devshed Supreme Being (6500+ posts)

    Join Date
    Feb 2003
    Location
    Toronto Canada
    Posts
    27,203
    Rep Power
    4279
    Originally Posted by Erez_Ko
    I have a date field in a table and I need to delete from that table where the field date is greater than the input date in the vb form.
    a simple comparison should do it
    Code:
    DELETE
      FROM daTable
     WHERE datefield > '#inputdate#'
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2013
    Posts
    5
    Rep Power
    0
    Oh I didn't knowbi have to put the '#' sign.. Thanks a lot!

IMN logo majestic logo threadwatch logo seochat tools logo