Actually John, an insert statement can have a FROM clause. I believe that Robert might have been confused on the syntax, but if he wanted to say pass an Id for a chosen Vendor he could have performed the following:
<CFIF selectvendor is not "New Vendor"> <cfquery name="addvendor" datasource="purchases"> INSERT INTO purchases ( vendor, Contact, Address) SELECT vendor, contact, Address FROM vendor where vendor = #selectedvendor# </cfquery> </CFIF> Or something of the like ... where he would get the contact and address information from the vendor's table and insert it into the purchases table. -----Original Message----- From: John Beynon [mailto:[EMAIL PROTECTED]] Sent: Tuesday, May 28, 2002 11:47 AM To: CF-Talk Subject: RE: populate a table SQL Insert statements can't have a FROM clause in them...that could be an issue! > -----Original Message----- > From: Robert Orlini [mailto:[EMAIL PROTECTED]] > Sent: 28 May 2002 16:47 > To: CF-Talk > Subject: populate a table > > > Hello, > > If a user selects a vendor from a drop-down list, I want to > populate a form and main table called "purchases" with the > info from the vendor data that I have in stored in another > table called "vendor". Here is some of the code that checks > the option field in the drop-down menu. I get a syntax error > with this though. > > Any better way? > > Robert O. > > <CFIF selectvendor is not "New Vendor"> > <cfquery name="addvendor" datasource="purchases"> > INSERT INTO purchases ( > vendor, > Contact, > Address) > VALUES ( > '#FORM.vendor#', > '#FORM.contact#', > '#FORM.Address#') > from selectedvendor > </cfquery> > </CFIF> > ______________________________________________________________________ This list and all House of Fusion resources hosted by CFHosting.com. The place for dependable ColdFusion Hosting. FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Archives: http://www.mail-archive.com/[email protected]/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

