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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

2 forms with 1 common text field, cant get form 2 to save data.

Status
Not open for further replies.

martinrobson

Programmer
Jun 2, 2003
19
0
0
GB
Hi,

Im having a problem with an application.

I have a setup were data is added to a database. There are 2 tables in the database, each with unique id's, x_id and y_id they are linked with a foreign key on x_id.

I am using 1 form that points to both tables, and this works great. I can add data no problem.

The problem is, that i need to be able to add more than one y_id entry in the second table, for each x_id. This should not be a problem. (i.e. sweet shop x can sell sweets y1, y2, y3 etc etc)

I have it set up so that a button on form 1 will open form 2 and carry across the same x_id from form 1, form 2 generates another y_id when it loads. All is working ok, until i try and save the data in form 2, for some reason it doesnt work.

I hope this makes sense, this is doing my nut :eek:).

Any ideas would be great.

Thanks
 
Hi, make sure that x_id is not unique in Table2, also y_id could be indexed but mustn't be unique.

Bill
 
Thanks guys, turns out that it was because the form was trying to add more data to the x_id table as well as the y_id table, which meant that it was trying to add another x_id to the table when there was allready one, and it is a unique
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top