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

Can't add data 1

Status
Not open for further replies.

smanuel

IS-IT--Management
May 15, 2000
15
CA
When I try to add data to a 3 tables using a form I get the following error.<br><br>&quot;Can't add or change a record because a related record in table 'table name'&quot;<br><br>What do I do? I've tried changing the relationships etc. but to no avail.<br><br>If you can help, it would be appreciated.<br><br>Scott Manuel<br><A HREF="mailto:smanual@mail.gov.nf.ca">smanual@mail.gov.nf.ca</A>
 
This normally means that you have a record in one table that does not relate to the other table, and only is an issue if you have Enforce Referential Integrity as part of your relationship.<br><br>For Example:<br><br>If Table 1 has the following entries<br><br><b>ID&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Value</b><br>-----------------------<br>1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Seattle<br>2&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Dallas<br>3&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Chicago<br>4&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Pittsburgh<br><br><br>And Table 2 has the following entries<br><br><b>ID&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;CityID&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Stores</b><br>------------------------------------<br>1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;2&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Sammy's Computers<br>2&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;2&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Billy Bob's Servers<br>3&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;3&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Matt's CompuHeaven<br><br>Now if you try to enter the following, you will get the error you are talking about:<br><br>4&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;5 *&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Computer's Galore<br><br><br>The CityID (5) Does not exist in the One side table, and will give you an error if you <br>try to add it. You will also get an error if you leave it blank or 0.<br><br>Check your data in both tables and make sure they all have matching values in the related fields.<br><br>Hope this helps.
 
If Jimmy's suggestion didn't help, check your table(s) relationships.&nbsp;&nbsp;When I encountered this error message, it was because the previous programmer had related the tables associated with linked forms.&nbsp;&nbsp;When a user opened one form, clicked on the linked form and attempted to enter data, the user got the same error message.<br><br>I had to check and optimize all the relationships.&nbsp;&nbsp;Once I did this, the error was resolved.&nbsp;&nbsp;I also suggest checking all the data types in this database.<br><br>Programmher
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top