John,

I see that bullets is one of the child tables, and that its bid field
provides the relationship to the parent table.  Where do nbrOrder and
bullet come from?  Which field comes from the child table's <input> field
on the entry template?

I ask in order to see if my method would work for you.  I have an entry
template with a form containing several text input elements for parent
table values, and a multiple-select element whose options each represent
an entry in a child table.  Upon submit I put the option values into a
hidden element as a list.  On the form's action page I insert a record
into the parent table and then I loop over the list, doing an insert into
the child table for each list item.

It ain't easy to explain, but your answers to my questions at the top may
make it more clear to us.

-David

On Wed, 25 Oct 2000 10:59:04 -0500 John Allred <[EMAIL PROTECTED]>
writes:
> 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
________________________________________________________________
YOU'RE PAYING TOO MUCH FOR THE INTERNET!
Juno now offers FREE Internet Access!
Try it today - there's no risk!  For your FREE software, visit:
http://dl.www.juno.com/get/tagj.
------------------------------------------------------------------------------------------------
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