I need some advice on how to set up a form that will either insert or
update data to multiple tables in the same database. I have a parent and
two child tables in an Access database, and there is a one-to-many
relationship established between the parent and each of the children. I'd
like to keep this so I can cascade deletes, but if need be, I can work
around it.

At present, the <FORM> on my entry template includes only one <INPUT> field
for one of the child tables. Using the following code in my action
template, I can use one form to insert a record in both tables.

<CFINSERT
     dataSource="annc"
     tableName="vendor"
     formfields="vendor, imageName"
     >

<cfquery datasource="annc" name="getID">
select max(vid) as bid
from vendor
</cfquery>

<cfquery datasource="annc">
insert into bullets(bid, nbrOrder, bullet)
values ('#getID.bid#', '#nbrOrder#', '#bullet#')
</cfquery>

Ideally, I'd like to be able to enter any number of child records at the
same time I create the parent record, using the same form. I'm thinking it
might be possible to switch to <CFFORM> and include a <CFGRID> for the
child tables.

Has anyone done something like this? And could you offer advice on this or
another approach. So far as I can find, CFWACK only has two paragraphs on
entering data in multiple tables (p. 271 in the 2nd ed.).

Thanks for any help.
--John Allred

------------------------------------------------------------------------------------------------
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists or send a message 
with 'unsubscribe' in the body to [EMAIL PROTECTED]

Reply via email to