Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
12-09-2004, 06:12 PM #1
- Join Date
- Dec 2004
- 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
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.
12-10-2004, 03:37 PM #2
- Join Date
- Apr 2003
- 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") )