Advertisement

04.15.2004 at 03:25AM PDT, ID: 20954951
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

9.4

Updating Multiple Tables in ColdFusion/MSAccess

Asked by leerljr68 in ColdFusion Application Server, ColdFusion Studio

Tags: , , , ,

What am I missing...I've been beating my head for the past two hours trying to get this to function properly and I think I'm missing something...anyone help????

I have one form for a user to update/add data to fields...once the form is submitted, I want it to update the information in the tables...now there are two tables that the data needs to update to.  

Here is my code for the form query (I even tried having two queries too) and the page address holds the EmpID (emp_file-awid.cfm?EmpID=1111111):

<CFIF ISDefined("EmpID")>
      <CFSET to_do="edit">
      <CFELSE>
      <CFSET to_do="add">
</CFIF>
<CFIF to_do IS "edit">
<CFQUERY datasource="myds" name="employees" blockfactor="100">
      SELECT *
      FROM tbl_employees, tbl_personal
      WHERE tbl_employees.EmployeeID=tbl_personal.EmployeeID
            AND tbl_employees.EmployeeID=tbl_employees.EmployeeID
            AND tbl_personal.EmployeeID=tbl_personal.EmployeeID
            AND tbl_employees.EmployeeID LIKE '#EmpID#%'
            AND tbl_personal.EmployeeID LIKE '#EmpID#%'
</CFQUERY>
</CFIF>

Here is my code for the form:

<FORM ACTION="empfile_update.cfm" METHOD="post">                  
<tr class="small">
      <td align="right"><b>First Name:</b></td>
      <td><INPUT TYPE="text" NAME="FirstName" size="25" class="small"
                  <CFIF to_do IS "edit">
                        VALUE="<CFOUTPUT>#employees.FirstName#</CFOUTPUT>"
                  </CFIF>
            >
      </td>
</tr>
<tr class="small">
      <td align="right"><b>MI:</b></td>
      <td><INPUT TYPE="text" NAME="MI" size="5" class="small"
                  <CFIF to_do IS "edit">
                        VALUE="<CFOUTPUT>#employees.MI#</CFOUTPUT>"
                  </CFIF>
            >
      </td>
</tr>
<tr class="small">
      <td align="right"><b>Last Name:</b></td>
      <td><INPUT TYPE="text" NAME="LastName" size="25" class="small"
                  <CFIF to_do IS "edit">
                        VALUE="<CFOUTPUT>#employees.LastName#</CFOUTPUT>"
                  </CFIF>
            >
      </td>
</tr>
<tr class="small">
      <td align="right"><b>Sort Name:</b></td>
      <td><INPUT TYPE="text" NAME="SortName" size="35" class="small"
                  <CFIF to_do IS "edit">
                        VALUE="<CFOUTPUT>#employees.SortName#</CFOUTPUT>"
                  </CFIF>
            >
      </td>
</tr>
<tr class="small">
      <td align="right"><b>Email Name:</b></td>
      <td><INPUT TYPE="text" NAME="EmailName" size="35" class="small"
                  <CFIF to_do IS "edit">
                        VALUE="<CFOUTPUT>#employees.EmailName#</CFOUTPUT>"
                  </CFIF>
            >
      </td>
</tr>
<tr class="small">
      <td align="right"><b>Extension:</b></td>
      <td><INPUT TYPE="text" NAME="Extension" size="10" class="small"
                  <CFIF to_do IS "edit">
                        VALUE="<CFOUTPUT>#employees.Extension#</CFOUTPUT>"
                  </CFIF>
            >
      </td>
</tr>
<tr class="small">
      <td align="right"><b>Wireless:</b></td>
      <td><INPUT TYPE="text" NAME="Wireless" size="15" class="small"
                  <CFIF to_do IS "edit">
                        VALUE="<CFOUTPUT>#employees.Wireless#</CFOUTPUT>"
                  </CFIF>
            >
      </td>
</tr>
<tr class="small">
      <td align="right"><b>Location:</b></td>
      <td><INPUT TYPE="text" NAME="Location" size="15" class="small"
                  <CFIF to_do IS "edit">
                        VALUE="<CFOUTPUT>#employees.Location#</CFOUTPUT>"
                  </CFIF>
            >
      </td>
</tr>
<tr class="subheadblue">
      <td colspan="2" height="35" valign="middle">Personal Information:</td>
</tr>
<tr class="small">
      <td align="right"><b>Address:</b></td>
      <td><INPUT TYPE="text" NAME="Address" size="35" class="small"
                  <CFIF to_do IS "edit">
                        VALUE="<CFOUTPUT>#employees.Address#</CFOUTPUT>"
                  </CFIF>
            >
      </td>
</tr>
<tr class="small">
      <td align="right"><b>City:</b></td>
      <td><INPUT TYPE="text" NAME="City" size="20" class="small"
                  <CFIF to_do IS "edit">
                        VALUE="<CFOUTPUT>#employees.City#</CFOUTPUT>"
                  </CFIF>
            >
      </td>
</tr>
<tr class="small">
      <td align="right"><b>State:</b></td>
      <td><INPUT TYPE="text" NAME="State" size="5" class="small"
                  <CFIF to_do IS "edit">
                        VALUE="<CFOUTPUT>#employees.State#</CFOUTPUT>"
                  </CFIF>
            >
      </td>
</tr>
<tr class="small">
      <td align="right"><b>Zip Code:</b></td>
      <td><INPUT TYPE="text" NAME="PostalCode" size="10" class="small"
                  <CFIF to_do IS "edit">
                        VALUE="<CFOUTPUT>#employees.PostalCode#</CFOUTPUT>"
                  </CFIF>
            >
      </td>
</tr>                                          
<tr class="subheadblue">
      <td colspan="2" height="35" valign="middle">Emergency Contact Information:</td>
</tr>
<tr class="small">
      <td align="right"><b>Contact Name:</b></td>
      <td><INPUT TYPE="text" NAME="ContactName" size="35" class="small"
                  <CFIF to_do IS "edit">
                        VALUE="<CFOUTPUT>#employees.EmrgcyContactName#</CFOUTPUT>"
                  </CFIF>
            >
      </td>
</tr>
<tr class="small">
      <td align="right"><b>Relation:</b></td>
      <td><INPUT TYPE="text" NAME="ContactRelation" size="20" class="small"
                  <CFIF to_do IS "edit">
                        VALUE="<CFOUTPUT>#employees.EmrgcyContactRelation#</CFOUTPUT>"
                  </CFIF>
            >
      </td>
</tr>
<tr class="small">
      <td align="right"><b>Phone:</b></td>
      <td><INPUT TYPE="text" NAME="ContactPhone" size="15" class="small"
                  <CFIF to_do IS "edit">
                        VALUE="<CFOUTPUT>#employees.EmrgcyContactPhone#</CFOUTPUT>"
                  </CFIF>
            >
      </td>
</tr>
<tr class="small">
      <td align="right"><b>Work:</b></td>
      <td><INPUT TYPE="text" NAME="ContactWork" size="15" class="small"
                  <CFIF to_do IS "edit">
                        VALUE="<CFOUTPUT>#employees.EmrgcyContactWork#</CFOUTPUT>"
                  </CFIF>
            >
      </td>
</tr>                                          
<tr class="subheadblue">
      <td colspan="2" height="35" valign="middle">Dependent Line Information:</td>
</tr>
<tr class="small">
      <td align="right"><b>Line 1:</b></td>
      <td><INPUT TYPE="text" NAME="DepWireless1" size="15" class="small"
                  <CFIF to_do IS "edit">
                        VALUE="<CFOUTPUT>#employees.DepWireless1#</CFOUTPUT>"
                  </CFIF>
            >
      </td>
</tr>
<tr class="small">
      <td align="right"><b>Line 2:</b></td>
      <td><INPUT TYPE="text" NAME="DepWireless2" size="15" class="small"
                  <CFIF to_do IS "edit">
                        VALUE="<CFOUTPUT>#employees.DepWireless2#</CFOUTPUT>"
                  </CFIF>
            >
      </td>
</tr>
<tr class="small">
      <td align="right"></td>
      <td><INPUT TYPE="hidden" NAME="EmployeeID"
                  <CFIF to_do IS "edit">
                        VALUE="<CFOUTPUT>#employees.EmployeeID#</CFOUTPUT>"
                  </CFIF>
            >
      </td>
</tr>
<tr class="small">
      <td colspan="2" align="center"><INPUT TYPE="submit" VALUE="Update Employee Record"></td>
</tr>
</FORM>

This is my code on the update page:

<!-- BEGIN Update Table 1 -->
<CFIF ISDefined("EmpID")>
      <CFSET to_do="edit">
      <CFELSE>
      <CFSET to_do="add">
</CFIF>
<CFIF to_do IS "edit">
<CFUPDATE datasource="harprod"
      TABLENAME="tbl_employees"
      FORMFIELDS="FirstName,MI,LastName,SortName,EmailName,Extension,Wireless">
</CFIF>
<CFIF to_do IS "add">
<CFUPDATE datasource="harprod"
      TABLENAME="tbl_employees"
      FORMFIELDS="FirstName,MI,LastName,SortName,EmailName,Extension,Wireless">
</CFIF>
<!-- END Update Table 1 -->
<!-- BEGIN Update Table 2 -->
<CFIF ISDefined("EmpID")>
      <CFSET to_do="edit">
      <CFELSE>
      <CFSET to_do="add">
</CFIF>
<CFIF to_do IS "edit">
<CFUPDATE datasource="harprod"
      TABLENAME="tbl_personal"
      FORMFIELDS="Address,City,State,PostalCode,HomePhone,EmrgcyContactName,EmrgcyContactRelation,EmrgcyContactPhone,EmrgcyContactWork,DepWireless1,DepWireless2">
</CFIF>
<CFIF to_do IS "add">
<CFUPDATE datasource="harprod"
      TABLENAME="tbl_personal"
      FORMFIELDS="Address,City,State,PostalCode,HomePhone,EmrgcyContactName,EmrgcyContactRelation,EmrgcyContactPhone,EmrgcyContactWork,DepWireless1,DepWireless2">
</CFIF>
<!-- END Update Table 2 -->
<!-- END Update Section -->


Start Free Trial
 
Loading Advertisement...
 
[+][-]04.15.2004 at 04:26AM PDT, ID: 10832022

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]04.15.2004 at 04:52AM PDT, ID: 10832179

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]04.16.2004 at 08:23AM PDT, ID: 10843276

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: ColdFusion Application Server, ColdFusion Studio
Tags: coldfusion, msaccess, tables, cfupdate, postalcod
Sign Up Now!
Solution Provided By: mrichmon
Participating Experts: 2
Solution Grade: A
 
 
[+][-]04.16.2004 at 11:05AM PDT, ID: 10844740

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]04.16.2004 at 01:51PM PDT, ID: 10845874

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]04.16.2004 at 11:54PM PDT, ID: 10848037

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]04.19.2004 at 10:16AM PDT, ID: 10861571

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32