the i of "If" must be in lower case Set RSSACode = Server.CreateObject("ADODB.Recordset");
I don't think javascript understands that. It looks like VBscript to me. Hope it helps Hai -----Original Message----- From: KEITH KOSMICKI [mailto:[EMAIL PROTECTED]] Sent: Friday, December 20, 2002 12:43 PM To: [EMAIL PROTECTED] Subject: Nested If Code Can someone point out what I might be doing wrong here? I get a syntax error with the following code, I've counted it several times and I'm sure the If Elses and { }'s are correct. Other than that It could be with the Recordset itself in the way it's defined. Any help is appreciated. Thank you, Keith Kosmicki function Validate(frmSuppAgenUpdate){ fUUAC=document.frmSuppAgenUpdate.SACode.value; fUUAN=document.frmSuppAgenUpdate.SAName.value; fUUAF=document.frmSuppAgenUpdate.SAFEIN.value; fUUCO=document.frmSuppAgenUpdate.SACounty.value; fUUAR=document.frmSuppAgenUpdate.SARegion.value; if (fUUAC==''){ alert('Supplemental Agency code is a required field. Please try again.'); document.frmSuppAgenUpdate.SACode.focus(); return false; } else { If (fUUAC!=5){ alert('The Supplemental Agency code must be 5 characters long. Please try again.'); document.frmSuppAgenUpdate.SACode.focus(); return false; } else { Set RSSACode = Server.CreateObject("ADODB.Recordset"); SQLSACode = "SELECT COUNT(*) as RECCNT FROM tblSupplementalAgency WHERE AgencyCode = """ & fUUAC & """"; RSSACode.open (SQLSACode, cnn); If (RSSACode.RECCNT > 0){ alert('The Supplemental Agency code is a duplicate of an existing. Please try again.'); document.frmSuppAgenUpdate.SACode.focus(); return false; } else { return true; } RSSACode.close(); RSSACode = null; } } if (fUUAN==''){ alert('Supplemental Agency name is a required field. Please try again.'); document.frmSuppAgenUpdate.SAName.focus(); return false; } if (fUUAF==''){ alert('Supplemental Agency FEIN/TIN is a required field. Please try again.'); document.frmSuppAgenUpdate.SAFEIN.focus(); return false; } if (fUUCO==-1){ alert('County Name for the Supplemental Agency has not been specified. Please try again.'); document.frmSuppAgenUpdate.SACounty.focus(); return false; } if (fUUAR==-1){ alert('Region for the Supplemental Agency ahs not been specified. Please try again.'); document.frmSuppAgenUpdate.SARegion.focus(); return false; } return true; } ==========================================================================To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST". For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST". Some relevant FAQs on JSP/Servlets can be found at: http://archives.java.sun.com/jsp-interest.html http://java.sun.com/products/jsp/faq.html http://www.esperanto.org.nz/jsp/jspfaq.jsp http://www.jguru.com/faq/index.jsp http://www.jspinsider.com =========================================================================== To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST". For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST". Some relevant FAQs on JSP/Servlets can be found at: http://archives.java.sun.com/jsp-interest.html http://java.sun.com/products/jsp/faq.html http://www.esperanto.org.nz/jsp/jspfaq.jsp http://www.jguru.com/faq/index.jsp http://www.jspinsider.com