Anthony904
IS-IT--Management
Hi,
I am trying to check for duplicates before inserting into my Access Table.
I am getting an error.
Any Ideas?
Thanks!
I am trying to check for duplicates before inserting into my Access Table.
I am getting an error.
Code:
Microsoft VBScript runtime error '800a01a8'
Object required: ''
/aspx/ip21/Survey_Process.asp, line 87
Code:
Dim name, date1, Building
Dim sConnString, connection, sSQL, RS
' Receiving values from Form, assign the values entered to variables
name = Request.Form("name")
date1 = Request.Form("date1")
Building =Request.Form("Building")
'Add check here for duplicates before INSERT
'If Duplicate found .. display duplicate and go correct.
[COLOR=red]set RS = connection.execute("select * from Sugg_tbl where Name = '"& request("Name") &"' ")[/color]
if RS.EOF = True then
'no duplicate of new data found, so insert data
'declare SQL statement that will query the database
sSQL = "INSERT into Sugg_tbl (name, date1, Building) values ('" & _
name & "', '" & date1 & "', '" & Building & "')"
else
response.write "duplicate found"
End If
'define the connection string, specify database
'driver and the location of database
sConnString="PROVIDER=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & Server.MapPath("asc.mdb")
'create an ADO connection object
Set connection = Server.CreateObject("ADODB.Connection")
set rs = Server.CreateObject("ADODB.recordset")
Any Ideas?
Thanks!