Helpful Information
 
 
Category: ColdFusion
CF / MS Access : Number of query values and destination fields are not the same.

hi newbie here with a Microsoft Access & Cold Fusion problem.

Im seem to be having some problems with a simple form that sends data post method to fusebox.cfm
The fusebox.cfm is supposed to take the variables and put it in my Microsoft Access DB. Unfortunately, I get an error that says:

[Macromedia][SequeLink JDBC Driver][ODBC Socket][Microsoft][ODBC Microsoft Access Driver] Number of query values and destination fields are not the same.

Here is my form:


<form name="distributionProfile" action="fusebox.cfm" method="post">
<input type="hidden" name="process" value="profile" />


<cfoutput query="pullUserID">
<input type="hidden" name="dist_user_id" value="#user_id#" />
</cfoutput>


<table width="600" cellspacing="4">
<tr class="table_color">
<td width="250" bgcolor="#E2E2E2"><div align="right"><strong>Orphanage Name</strong></div></td>
<td><input name="orphanage_name" type="text" id="orphanage_name" size="40" maxlength="255"></td>
</tr>
<tr>
<td bgcolor="#E2E2E2"><div align="right"><strong>Date of Distribution </strong></div></td>
<td class="table_color"><input name="distributionDate" type="text" id="orphanage_name2" size="40" maxlength="255" /> </td>
</tr>
<tr>
<td width="250" bgcolor="#E2E2E2"><div align="right"><strong>Orphanage ID</strong></div></td>
<td><input name="orphanage_ID" type="text" id="orphanage_ID" size="10" maxlength="255"></td>
</tr>
<tr>
<td width="250" bgcolor="#E2E2E2"><div align="right"><strong>Geographic Location</strong></div></td>
<td><input name="geographic_location" type="text" id="geographic_location" size="40" maxlength="255"></td>
</tr>
<tr>
<td width="250" bgcolor="#E2E2E2"><div align="right"><strong>Kilometers from Chisinau</strong></div></td>
<td><input name="kilometer_chisinau" type="text" id="kilometer_chisinau" size="10" maxlength="255"></td>
</tr>
<tr>
<td width="250" bgcolor="#E2E2E2"><div align="right"><strong>Weather Conditions</strong></div></td>
<td><input name="weather_conditions" type="text" id="weather_conditions" size="40" maxlength="255"></td>
</tr>
<tr>
<td width="250" bgcolor="#E2E2E2"><div align="right"><strong>Number of Children</strong></div></td>
<td><input name="num_of_children" type="text" id="num_of_children" size="10" maxlength="255"></td>
</tr>
<tr>
<td width="250" bgcolor="#E2E2E2"><div align="right"><strong>Number of Families who received Foodbags</strong></div></td>
<td><input name="num_of_fam_foodbags" type="text" id="num_of_fam_foodbags" size="10" maxlength="255"></td>
</tr>
<tr>
<td width="250" valign="top" bgcolor="#E2E2E2"><div align="right"><strong>Summary</strong></div></td>
<td>
<textarea name="summary" cols="35" rows="4" id="summary"></textarea> </td>
</tr>
<tr>
<td width="250" valign="top" bgcolor="#E2E2E2"><div align="right"><strong>Other Comments</strong></div></td>
<td><textarea name="other_comments" cols="35" rows="4" id="other_comments"></textarea></td>
</tr>
<tr>
<td width="250" bgcolor="#E2E2E2"><div align="right"><strong>Lsm Personnel name</strong></div></td>
<td><input name="lsm_personnel" type="text" id="lsm_personnel" size="40" maxlength="255"></td>
</tr>
<tr>
<td width="250" align="right" valign="top" bgcolor="#E2E2E2"><div align="right"><strong>Quotes </strong></div></td>
<td><table width="100%">
<tr>
<td width="25%">From:</td>
<td>
<input name="quote_from" type="text" id="quote_from" size="40" /> </td>
</tr>
<tr>
<td width="25%">Item:</td>
<td><input name="quote_item" type="text" id="quote_item" size="40" /></td>
</tr>
<tr>
<td width="25%">Remark:</td>
<td><textarea name="quote_remark" cols="35" rows="4" id="quote_remark"></textarea></td>
</tr>
</table></td>
</tr>
<tr>
<td width="250"><div align="right"></div></td>
<td>
<label>
<input type="reset" name="Reset" value="Reset">
<input type="submit" name="Submit2" value="Submit">
</label> </td>
</tr>
</table>
</form>


Here is my fusebox.cfm code:


<cfcase value="profile">

<cfquery datasource="distribution" name="addInfo">

INSERT INTO distribution_profile ( orphanage_name,
distribution_date,
orphanage_id,
geographic_location,
k_from_chisinau,
weather_condidtions,
num_of_children,
num_of_fam_rec_foodbags,
[summary],
other_comments,
lsm_personel_name,
dist_user_id)

VALUES ( '#FORM.orphanage_name#',
'#FORM.distributionDate#',
'#FORM.orphanage_ID#',
'#FORM.geographic_location#',
'#FORM.kilometer_chisinau#',
'#FORM.weather_conditions#',
'#FORM.num_of_children#',
'#FORM.num_of_fam_foodbags#',
'#FORM.summary#',
'#FORM.other_comments#',
'#FORM.other_comments#',
'#FORM.lsm_personnel#',
#FORM.dist_user_id#)

</cfquery>



<cfquery datasource="distribution" name="quotes">

INSERT INTO quote ( quote_remark,
quote_from,
quote_item)

VALUES ( '#FORM.quote_remark#',
'#FORM.quote_from#',
'#FORM.quote_item#');
</cfquery>

<cflocation url="index.cfm">
</cfcase>



The database has 4 tables: quote, user, distribution_profile, picture

the relations are:
1 to many - disribution_profile to picture (distribution_id to pic_distribution_id)
1 to many - distribution_profile to quote (distribution_id to quote_distribution_id)
1 to many distribution_profile to user (dist_user_id to user_id)

I figured it out,

the values were sending 2 '#FORM.other_comments#', instead of one.

:confused: Another problem: Now my Access database has duplicate entries. It appears the form processes it more than once and I get duplicates :eek:










privacy (GDPR)