5 Replies Latest reply on Feb 9, 2007 8:34 AM by Dan Bracuk

    Using CFquery to insert


      I am using CFquery to insert data from a form into an Access database. If all fields are not entered a message is returned indicating that "Element X is undefined in FORM." The Access database fields allow null values. If I entered data into every field it works fine. I have tried using cfqueryparam to check for null but have had no luck. My code is below. Any help is greatly appreciated.

      INSERT INTO ISDSUserSurvey
      VALUES <cfqueryparam value="#trim(form.1)#" cfsqltype="CF_SQL_VARCHAR" null="#YesNoFormat(not(len(trim(form.1))))#"/>

      and this code:

      INSERT INTO ISDSUserSurvey
      VALUES (<cfif IsDefined("#Form.1#") AND "#Form.1#" NEQ "">