Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Dec 2004
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Short Date Compare to Current Insert vs Update

    I have a question on a task I'm working on and hope someone can provide a little help.

    I have an ASP application with an Access DB backend. When the user logins into the site, I authenticate them and then do one of two things.

    I update the number of Accesses to the site for the user and set the Last Access Date to current date in short format

    or

    if the Last Access Date is not in the current month, I insert a new record setting the Accesses count to one and adding a Last Access Date of current

    The issue is that I don't know how to write the SQL to compare the current date month to the last access date month in the DB for the user and then update or insert based on the compare.

  • #2
    Senior Coder
    Join Date
    Apr 2003
    Location
    England
    Posts
    1,192
    Thanks
    5
    Thanked 13 Times in 13 Posts
    i dont really know what you are trying to do but you can try this for a part of it

    If Month(Date()) <> Month(rsLastAccess("lastaccessdate")) Then objConn.Execute("UPDATE users SET lastaccessdate = '" & Date() & "' WHERE id = " & rsLastAccess("id") )


  •  

    Posting Permissions

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