View Full Version : Short Date Compare to Current Insert vs Update

12-09-2004, 07:12 PM
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, 04:37 PM
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") )