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

HELP!!!

Status
Not open for further replies.

Kennya1

Programmer
Joined
Apr 14, 2002
Messages
15
Location
US
I am trying to relate two database in Vb6 and get the following error

"You can't add or change a record because a related record is required in table "

Also (this is a real newbie question) once related and your at a record in the first database how do you get the information on the foreign database

Any web site tutorials will help
 
You are probably getting this error because the "Enforce Referential Integrity" box is check in the relationship, and you added or changed a record that violated the referential integrity of the database.

If you have the parent table open and the relationship is set properly, Access places a + sign to the far left of each record. If you click the + sign, it will show you the data for the related child table.

dz
 
THanks for the advice. I get this error when trying to set the relationship in Visual Basic 6. WITH THE FOLOWING CODE


Set db = OpenDatabase("All Data.mdb")

Set rel = db.CreateRelation("Test")
With rel
.Table = "ChartNew"
.ForeignTable = "D2002"
End With

rel.Fields.Append rel.CreateField("Name")
rel.Fields("Name").ForeignName = "Name"

db.Relations.Append rel
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top