Hi there,
Im trying to find the correct code that will take my variable (txtcomments) and check it with what is already in my access database field called 'Team'.
If it cant find it already - it adds it to database
If it does find it already - it wont add & redirects
I already have the 'add to database' part and it works fine - can someone PLEASE help me with the duplicate entry check code? Ive searched the net and cant find anything suitable yet. How do i get it to check whats already there and compare it, then act accordingly?
Here is my page so far:-
-----------------------------------------------
<% If Request.Form("txtcomments") = "" then %>
<% Response.Redirect("notext.htm") %>
<%End If%>
<%
'Dimension variables
Dim AO_GB_Connect
Dim rsAddComments
Dim SQL_String &n bsp;
Set AO_GB_Connect = Server.CreateObject("ADODB.Connection")
AO_GB_Connect.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("table.mdb")
Set rsAddComments = Server.CreateObject("ADODB.Recordset")
SQL_String= "SELECT * FROM List"
rsAddComments.CursorType = 2
rsAddComments.LockType = 3
rsAddComments.Open SQL_String, AO_GB_Connect
rsAddComments.AddNew
rsAddComments.Fields("Team") = Request.Form("txtcomments")
rsAddComments.Update
rsAddComments.Close
Set rsAddComments = Nothing
Set AO_GB_Connect = Nothing
%>
----------------------------------------------
Please help - thank you very much
Red