bean262
07-26-2004, 08:47 PM
I have a form that requires users to select a date from the drop down menu. If a date is not select, error message appears. I want the page to return a different error if a date selected is already in the database. Here's my code thus far:
dim Err, rsCKDupDates
Set rsCKDupDates = CreateObject("ADODB.Recordset")
Sql ="Select distinct Attend_Date as DupDates From table WHERE table.PEOPLE_CODE_ID= 'P" & Session("peopleID") & " '"
rsCKDupDates.Open sql, conn
Err = False
'force user to choose a goal
IF Request.Form("Date") = "BAD" OR (IsNull(Request.Form("place"))) or (Request.Form("Date") = rsCKDupDates("DupDates")) then
Response.write "<center><strong class='error'>You must enter the date and the name of the place you wish to record, in order to continue.</strong></center><br>"
end if
According to this code however, if it worked the way I want it to, it would return the SAME error message for all three "IF" scenarios.
Instead, I would rather have it return a second/separate error message if the date in the form was already present in the database.
Any and all advice is greatly appreciated!
--Steve
dim Err, rsCKDupDates
Set rsCKDupDates = CreateObject("ADODB.Recordset")
Sql ="Select distinct Attend_Date as DupDates From table WHERE table.PEOPLE_CODE_ID= 'P" & Session("peopleID") & " '"
rsCKDupDates.Open sql, conn
Err = False
'force user to choose a goal
IF Request.Form("Date") = "BAD" OR (IsNull(Request.Form("place"))) or (Request.Form("Date") = rsCKDupDates("DupDates")) then
Response.write "<center><strong class='error'>You must enter the date and the name of the place you wish to record, in order to continue.</strong></center><br>"
end if
According to this code however, if it worked the way I want it to, it would return the SAME error message for all three "IF" scenarios.
Instead, I would rather have it return a second/separate error message if the date in the form was already present in the database.
Any and all advice is greatly appreciated!
--Steve