What's the error you're getting? Does it occur when there isn't a record for the user?

If you're checking both conditions in the same if statement, IIRC it will try and 
evaluate both and fall over evaluating the second if EOF is true, rather than stopping 
evaluating the conditions because EOF is true.

I'd tend to do this with a variable, along the lines of this :-

bSend = true
if objRS.EOF then
        bSend = false
elseif objRS("DateContacted") < DateAdd ("d", -90, Date) then
        bSend = false
end if

if bSend then
        response.write "Your submission hs been sent."
end if

You might have to split them down into two seperate if statements, I'm not sure.

Dan
www.diado.com

-----Original Message-----
From: professorw999 [mailto:[EMAIL PROTECTED]
Sent: 15 September 2004 16:10
To: [EMAIL PROTECTED]
Subject: [ASP] SQL Error using DateAdd



I've got an error in the date portion of the line below I can't 
figure out.  To protect from spam, we have a contact form that we 
only want to allow submissions to go through if a record does not 
exist for the user or if the date in the DateContacted field is more 
than 90 days ago.

Anyone know the fix?

IF objRS.EOF OR objRS("DateContacted") < DateAdd ("d", -90, Date) 
THEN

Response.Write "Your submission has been sent."

Thanks,
PW




---------------------------------------------------------------------    
 Home       : http://groups.yahoo.com/group/active-server-pages
---------------------------------------------------------------------
 Post       : [EMAIL PROTECTED]
 Subscribe  : [EMAIL PROTECTED]
 Unsubscribe: [EMAIL PROTECTED]
--------------------------------------------------------------------- 
Yahoo! Groups Links



 





------------------------ Yahoo! Groups Sponsor --------------------~--> 
$9.95 domain names from Yahoo!. Register anything.
http://us.click.yahoo.com/J8kdrA/y20IAA/yQLSAA/17folB/TM
--------------------------------------------------------------------~-> 

---------------------------------------------------------------------    
 Home       : http://groups.yahoo.com/group/active-server-pages
---------------------------------------------------------------------
 Post       : [EMAIL PROTECTED]
 Subscribe  : [EMAIL PROTECTED]
 Unsubscribe: [EMAIL PROTECTED]
--------------------------------------------------------------------- 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/active-server-pages/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 

Reply via email to