This topic is locked

prevent double entries

1/11/2007 2:40:24 PM
ASPRunnerPro General questions
L
lililpz@hotmail.com author

I am working in an employee database. Weekly we enter new employees and volunteers into the database and I need to check for the existence of the employees (EmployeID & EmployeeName). Both fields are "text" in the access database.
I am using the following code.
Function BeforeAdd(dict)
' Parameters:

' dict - Scripting.Dictionary object.

' Each field on the Add form represented as 'Field name'-'Field value' pair
'** Check if specific record exists ****

strSQLExists = "select * from Master where EmployeID='"& dict("EmployeID")&"' and EmployeeName = '" & dict("EmployeeName") &"'"
set rsExists = CreateObject("ADODB.Recordset")

Response.write strSQLExists
rsExists.Open strSQLExists, dbConnection
if not rsExists.eof then

Respone.write "This employee Number already exist"

BeforeAdd=False
else

' if dont exist do something else
end if

rsExists.Close : set rsExists = Nothing
BeforeAdd = True
' set BeforeAdd to True if you like to proceed with adding new record

' set it to False in other case
End Function
But I am getting the following error 424 OBJECT REQUIRED
Is the code or event wrong?

Sergey Kornilov admin 1/11/2007

Respone.write "This employee Number already exist"

should be

ResponSe.write "This employee Number already exist"