This topic is locked

Isnull - Check if specific record exists

8/8/2011 10:19:33 AM
ASPRunnerPro General questions
Y
yairilan author

Hi All,

I'm using the function "Check if specific record exists " for Email check before record is added

And it works well, if the user put an email record, BUT, if the user leave the field empty - it gives an error.
I've read all the related posts in the forum, and Iv'e tried to use "If values("Email")="" , or "If values("Email")=IsNull", but it didn't work.

I'll be glad to get some help - What I want is that if the field Email is empty, it will just add the record without cheking.
Here is the code:



Function BeforeAdd(ByRef values,ByRef message,inline)
Dim dict

Set dict = values
'** Check if specific record exists ****

dim rsExists

set dal_table=dal.Table("Tbl_olim")

set rsExists = dal_table.Query("Email='" & values("Email") & "'","")

if not rsExists.eof then

Response.Write "<script>alert('This Email already exsists');</script>"

BeforeAdd=false

else

BeforeAdd=true
end if

rsExists.Close : set rsExists = Nothing

End Function ' BeforeAdd

arrEventTables("BeforeAdd")="dbo.Tbl_Olim"

arrAvailableEvents("BeforeAdd")=true


Thanks

Yair