If Then HELP - big points for quick, simple and detailed return - 250pts possible!
Posted on 2003-03-19
I want to check to make sure that there are NO duplicate entries in a table with a variable that is entered in a form. What you don't see is the form which includes many input fields. The user selects a button to submit the form and is prompted with a "Are You Sure" window. Once the user approves the processing of the form then a SINGLE field, HNUM is compared to assure that no duplicates exist in the Oracle table. The HNUM field must be unique.
Very simply, I want an error page to be displayed (error-duplicate.cfm) if the variable in the form (form.hnum) equals that of the table hnum (duplicheck.hnum).
The code below only shows a simple test (TRUE/FALSE). I want for the TRUE test the error-duplicate.cfm page to be displayed in a floating-type window. If FALSE then the table will update the single record from the form.
PROBLEM: There are over 30,000 records in the table and I receive a TRUE or FALSE statement for each. I don't want that. I want a single true statement (error-duplicate.cfm) or a single false process to take place.
Code looks like this:
<cfquery name="Duplicheck" datasource="gisweb" dbtype="OLEDB">
select * from iwcgis.hydttemp
<CFSET Duplicheck = Duplicheck>
<CFIF form.HNUM eq Duplicheck.hnum>