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!

Linking 2 seperate forms

Status
Not open for further replies.

bryand34

MIS
Nov 26, 2002
3
0
0
US
Trying to avoid using subforms. Just as an example,
I have 2 tables Name and Color. I have my relationship
set up as a 1 to many. A name can have many favorite colors. I have also created 2 seperate forms. A frm_name
and frm_color. I want to execute frm_name, input a name, click a button to bring up frm_color and insert multiple favorite colors for the name I just entered in frm_name.
Using the form wizard in Access, I was able to link the 2 forms but when click the frm_name button to go to frm_color, the nameid from frm_name does not appear in the nameid field in frm_color. When I try to save the data entered in frm_color, I get the error message "you can't add or change a record because a related record is required in table tbl_name. What is going on here? I have 2 tables tble_name and tbl_color. As mentioned earlier, I am using a one to many on the nameid field in tbl_name to the nameid field in tbl_color. In my tbl_name, the nameid field ins the PK. In my tbl_color, colorid is the PK. Any help would be appreciated. Thank.
 
Make sure that the record of the name table is saved before you go to the colour table.

First try to go to the next record and then go to the previous record then go to the the colour form. If this works then you know the problem lies with the saving of the record.

What you do is do an Update command in code just before you go to the colour form.

This will properly solve your problem

Hope it helps
 
Thanks! I will try that. When you say update command, do
you mean writing code that automatically saves my record
in the name form before proceeding to the color form? I
will get back to you with my results. Thanks for your time.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top