cpuphantom
IS-IT--Management
Hi Group,
I'm working on building a database driven site using ASP and an Access database. I am trying to make an IF statement checking to see if a record already exists for a date. If there is a date, the app does nothing, if the record for that date doesn't exist, it inserts a record with default values. The problem is that even when that record with the date exists, the result is always false.
I changed the data type in Access from Date to Number to see its real value. 1/31/2001 became the number 36921. Where did that come from? So I change the data type back to date, and then went to my asp line and changed it to test for 36921 and it finally became true!!! Here is the line I am using:
<%
Function CurrentRecExist(usernm, recdate)
set recset = canvasDB.execute("select * from tbNumbers WHERE datestamp = 36921"
if recset.EOF then
CurrentRecExist = FALSE
else
CurrentRecExist = TRUE
end if
End Function
%>
Is there anyway I can replace the "36921" with a variable or date like 1/31/2001 that makes more sense and finally have it return a true when the record does exist instead of always false??? Or is there a
function to convert 1/31/2001 into its numerical equivelent 36921 to test apples with apples?
Any help is completely appreciated...
Thanks,
Reagan
I'm working on building a database driven site using ASP and an Access database. I am trying to make an IF statement checking to see if a record already exists for a date. If there is a date, the app does nothing, if the record for that date doesn't exist, it inserts a record with default values. The problem is that even when that record with the date exists, the result is always false.
I changed the data type in Access from Date to Number to see its real value. 1/31/2001 became the number 36921. Where did that come from? So I change the data type back to date, and then went to my asp line and changed it to test for 36921 and it finally became true!!! Here is the line I am using:
<%
Function CurrentRecExist(usernm, recdate)
set recset = canvasDB.execute("select * from tbNumbers WHERE datestamp = 36921"
if recset.EOF then
CurrentRecExist = FALSE
else
CurrentRecExist = TRUE
end if
End Function
%>
Is there anyway I can replace the "36921" with a variable or date like 1/31/2001 that makes more sense and finally have it return a true when the record does exist instead of always false??? Or is there a
function to convert 1/31/2001 into its numerical equivelent 36921 to test apples with apples?
Any help is completely appreciated...
Thanks,
Reagan