home *** CD-ROM | disk | FTP | other *** search
- <!-- #include file="Functions.inc" -->
- <%
- response.buffer = false
- NewValue=request.querystring("NewValue")
- TableName=request.querystring("Table")
- FieldNameID=request.querystring("FieldID")
- FieldNameDesc=request.querystring("FieldDesc")
- cmbName=request.querystring("cmbName")
- AllowDup=request.querystring("AllowDup")
- ExtraFields=request.querystring("ExtraFields")
- if (NewValue = "") or (TableName="") or (FieldNameID="") or (FieldNameDesc="") then
- Response.Write "<script LANGUAGE=""VBSCRIPT"">"&Chr(10)
- response.write "Msgbox ""No Value was entered. Please retry this opperation.""" & chr(10)
- Response.Write "</SCRIPT>"
- response.end
- end if
- if Not AllowDup then
- strSQL="SELECT * FROM "& TableName &" WHERE "& FieldNameDesc &" = '" & NewValue & "'"
- set Conn=server.createobject("adodb.connection")
-
- '******************************************************************************
- 'You can put the Connection parameters into application variables if you want!!
- '******************************************************************************
- ' conn.open Application("DSN"), Application("uid"), Application("pwd")
- conn.open "TESTCOMBO", "Admin", ""
-
- Set Rs = Conn.execute (strSQL)
- if not Rs.eof then
- Response.Write "<script LANGUAGE=""VBSCRIPT"">"&Chr(10)
- response.write "Msgbox ""The Value you entered already excist in the database.""" & chr(10)
- Response.Write "</SCRIPT>"
- response.end
- end if
- rs.close
- set rs = nothing
- set Conn = nothing
- end if
- NewNum = CreateMaxIDExt(TableName,FieldNameID,FieldNameDesc,"'" & NewValue & "'")
- if NewNum = -1 then
- Response.Write "<script LANGUAGE=""VBSCRIPT"">"&Chr(10)
- response.write "Msgbox ""Couldn't retrieve a new number. Please retry this opperation.""" & chr(10)
- Response.Write "</SCRIPT>"
- response.end
- end if
-
- Response.Write "<script LANGUAGE=""VBSCRIPT"">"&Chr(10)
- Response.write " Sub Window_onload()"&chr(10)
- Response.write " Call Parent.AddToList("""& NewValue &""","& NewNum &",Parent."& cmbName &")"&chr(10)
- Response.write " End Sub"&Chr(10)&Chr(10)
- Response.Write "</SCRIPT>"
- Response.end
- %>
-