Results 1 to 3 of 3
  1. #1
    3 Star Lounger
    Join Date
    Aug 2002
    Location
    Brisbane, Queensland, Australia
    Posts
    387
    Thanks
    0
    Thanked 1 Time in 1 Post

    relationship error (XP)

    Thnks for the last one Hans - you really are a fabulous help,
    I'm using the code to add a relationship -
    Set relRelationship = dbDatabase.CreateRelation(strRelationship, strTableOne, strTableMany, dbRelationUpdateCascade)

    relRelationship.Fields.Append relRelationship.CreateField(strFieldOne)
    relRelationship.Fields(strFieldOne).ForeignName = strFieldMany
    dbDatabase.Relations.Append relRelationship

    but I get an error "invlalid field definition <strFieldOne> in definition of index or relationship" I think there is a problem in the second last line but I can't work it out.

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: relationship error (XP)

    I tried your code in my test database and it created a relationship without errors, so I suspect there is something wrong with the field name - are you sure strFieldOne has a correct value?

  3. #3
    3 Star Lounger
    Join Date
    Aug 2002
    Location
    Brisbane, Queensland, Australia
    Posts
    387
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: relationship error (XP)

    Found the Problem - I had not created the foreign key field - thanks, it aways helps when you know where not to look.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •