Papa_Bear1
Member
- Local time
- Today, 05:49
- Joined
- Feb 28, 2020
- Messages
- 155
So,
I'm trying to do exactly the same thing as this post...
https://www.access-programmers.co.u...s-from-an-external-database.86740/post-387504
I'm trying to create relationships in an external database, based on data I've previously saved in a file.
The data saved looks fine... and I'm sure it is syntactically correct since I can create relationships from it - but - when it comes to creating a relationship with more than one field pair, it seems to always create an extra instance (alias) of the particular table.
In particular - looking at their code segment in the post referenced above:
I get error 3219 (Invalid operation) on the .Append command.
I don't understand why I can't create an extra field in an already established "relation".
Also, maybe someone can clarify if I'm understanding the mechanism/terminology correctly.
It seems like when they say "relation" it is actually a table (that has relationships), and then the actual relationships (lines between tables) are modeled when you add the fields.
This seems to be at the crux of it because, if that interpretation is right, this would mean I want to create one relation, and then two sets of field pairs, but it won't let me create anything beyond the first set of fields. I can loop through all relations, and treat each one separately, it seems completely unaware when the SAME table is used more than once and creates an alias. Thus, the resulting relationships do not reflect the original.
What am I missing?
Why did their code work, looping through fields and adding, where mine does not?
thanks!!
I'm trying to do exactly the same thing as this post...
https://www.access-programmers.co.u...s-from-an-external-database.86740/post-387504
I'm trying to create relationships in an external database, based on data I've previously saved in a file.
The data saved looks fine... and I'm sure it is syntactically correct since I can create relationships from it - but - when it comes to creating a relationship with more than one field pair, it seems to always create an extra instance (alias) of the particular table.
In particular - looking at their code segment in the post referenced above:
Code:
For Each imField In .Fields
fName = imField.name
fFName = imField.ForeignName
taRel.Fields.Append taRel.CreateField(fName)
taRel.Fields(fName).ForeignName = fFName
Next
I get error 3219 (Invalid operation) on the .Append command.
I don't understand why I can't create an extra field in an already established "relation".
Also, maybe someone can clarify if I'm understanding the mechanism/terminology correctly.
It seems like when they say "relation" it is actually a table (that has relationships), and then the actual relationships (lines between tables) are modeled when you add the fields.
This seems to be at the crux of it because, if that interpretation is right, this would mean I want to create one relation, and then two sets of field pairs, but it won't let me create anything beyond the first set of fields. I can loop through all relations, and treat each one separately, it seems completely unaware when the SAME table is used more than once and creates an alias. Thus, the resulting relationships do not reflect the original.
What am I missing?
Why did their code work, looping through fields and adding, where mine does not?
thanks!!