Hi all,
I was looking through the past thread and found thread333-1019874 regarding checking for duplicate records.
I tried checking for duplicate record for one data field using the solutions given and it works.
My question is if I have 2 or more data fields to check for duplicate records, how can I go about doing it?
Here is my code that I have written and it doesn't work, the records are still being inserted.
Any help will be appreciated
<%
Dim connectAdd
Dim recstAdd
Dim SQL
Dim strProjID1, strFeature1
%>
<%
Set connectAdd = Server.CreateObject("ADODB.Connection")
connectAdd.Open("DRIVER={Microsoft Access Driver (*.mdb)};" _
& "DBQ=" & Server.MapPath("Estimation.mdb"))
strProjID1 = request.form("ProjID1")
strFeature1 = request.form("Feature1")
SQL ="SELECT FeatName from FuncFeat where FeatName = '"& strFeature1 &"'"
Set recstAdd = connectAdd.Execute(SQL)
If recstAdd.EOF Then
SQL="INSERT INTO FuncFeat(FeatName) VALUES ('"& strFeature1 & "')"
Set recstAdd = connectAdd.Execute(SQL)
Response.Redirect("New Features Added.htm")
SQL ="SELECT ProjID from FuncFeat where ProjID = '"& ProjID1 &"'"
Set recstAdd = connectAdd.Execute(SQL)
If recstAdd.EOF Then
SQL="INSERT INTO FuncFeat(ProjID) VALUES ('"& strProjID1 & "')"
Set recstAdd = connectAdd.Execute(SQL)
Response.Redirect("New Features Added.htm")
Else
Response.Write "Sorry, Feature1 Exist!"
End If
Else
Response.Write "Sorry, Feature1 Exist!"
I was looking through the past thread and found thread333-1019874 regarding checking for duplicate records.
I tried checking for duplicate record for one data field using the solutions given and it works.
My question is if I have 2 or more data fields to check for duplicate records, how can I go about doing it?
Here is my code that I have written and it doesn't work, the records are still being inserted.
Any help will be appreciated
<%
Dim connectAdd
Dim recstAdd
Dim SQL
Dim strProjID1, strFeature1
%>
<%
Set connectAdd = Server.CreateObject("ADODB.Connection")
connectAdd.Open("DRIVER={Microsoft Access Driver (*.mdb)};" _
& "DBQ=" & Server.MapPath("Estimation.mdb"))
strProjID1 = request.form("ProjID1")
strFeature1 = request.form("Feature1")
SQL ="SELECT FeatName from FuncFeat where FeatName = '"& strFeature1 &"'"
Set recstAdd = connectAdd.Execute(SQL)
If recstAdd.EOF Then
SQL="INSERT INTO FuncFeat(FeatName) VALUES ('"& strFeature1 & "')"
Set recstAdd = connectAdd.Execute(SQL)
Response.Redirect("New Features Added.htm")
SQL ="SELECT ProjID from FuncFeat where ProjID = '"& ProjID1 &"'"
Set recstAdd = connectAdd.Execute(SQL)
If recstAdd.EOF Then
SQL="INSERT INTO FuncFeat(ProjID) VALUES ('"& strProjID1 & "')"
Set recstAdd = connectAdd.Execute(SQL)
Response.Redirect("New Features Added.htm")
Else
Response.Write "Sorry, Feature1 Exist!"
End If
Else
Response.Write "Sorry, Feature1 Exist!"