Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Remove contact from table by using email address 2

Status
Not open for further replies.

wilcoHead

Programmer
Feb 2, 2005
85
Hello;

I would like to create a form that will simply ask a user that wants to be removed from a mailing list for their
email address (EmailFld). I cannot get it to work. I am using MS Access DB - This is what I have:

---------------------------
CODE:
---------------------------
<TABLE CELLSPACING="3" CELLPADDING="3" BORDER="0">
<FORM ACTION="wack_contact.cfm" METHOD="post">
<TR>
<TD VALIGN="top">E-mail Address</TD>
<TD VALIGN="top"><INPUT TYPE="text" NAME="EmailFld" SIZE="20" STYLE="border: 1px solid Silver;"></TD>
</TR>

<TD COLSPAN="2" VALIGN="top"><INPUT TYPE="submit" NAME="Add" VALUE="submit" STYLE="border: 1px solid Silver;"> &nbsp; <INPUT TYPE="reset" NAME="Reset" VALUE="Clear" STYLE="border: 1px solid Silver;"></TD>
</TR>
</FORM>
</TABLE>
-----------------------------------------
SQL
-----------------------------------------
<CFQUERY NAME="DeleteContacts" DBTYPE="ODBC" DATASOURCE="#request.dsn#">

DELETE MailID, EmailFld, NameFld

FROM MailTable

WHERE EmailFld = #FORM.EmailFld#

</CFQUERY>

Thanks for your input;
WilcoHEAD
 
Code:
<CFQUERY NAME="DeleteContacts" DBTYPE="ODBC" DATASOURCE="#request.dsn#">

DELETE FROM MailTable

WHERE EmailFld = #FORM.EmailFld#

</CFQUERY>

Wullie

Fresh Look - Quality Coldfusion/Windows Hosting

The pessimist complains about the wind. The optimist expects it to change. The leader adjusts the sails. - John Maxwell
 
Hi

What error do you get? Dont forget to wrap your form field in single quotes ....

Code:
<CFQUERY NAME="DeleteContacts" DBTYPE="ODBC" DATASOURCE="#request.dsn#">

DELETE FROM MailTable

WHERE EmailFld = '#FORM.EmailFld#'

</CFQUERY>
 
Thanks to both of you.

That worked!



Thanks for your input;
WilcoHEAD
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top