PDA

View Full Version : Inserting record into joined table that relates to previously inserted record


Shaft
06-14-2005, 04:10 PM
I have created a form in dreamweaver that inserts a record into a database which works perfectly. This table has an autonumber ID field so that each record is unique which is joined to another table's ID field in a one-to-many relationship.

What I want to happen with my form is that after it is submited is to open another form which can be submitted multiple times into the joined table and relate back to the orignally submitted form.

This task is easy within access with a main form, subform setup but I am new to web design and don't know where to start with this problem. I realise that I need to somehow retrieve the ID of the orignally submited record and input that in the joined table records for each entry but don't know where to start.

Shaft
06-14-2005, 04:48 PM
The only way I can think of doing it is to create the unique ID on the web form so that it is known then pass the value as a global varible to the new form.

Is this the best way do you think?

miranda
06-14-2005, 11:23 PM
A simple way to do this is to do a query on the table after you have inserted the record.
SELECT ID FROM table WHERE somefield = 'somevalue'
You now have the value of the ID field