Using VBA to manipulate tables/indexes etc

gemma-the-husky

Super Moderator
Staff member
Local time
Today, 13:54
Joined
Sep 12, 2006
Messages
16,072
Using VBA to manipulate tables/indexes etc [SOLVED!]

Here's One

I am trying to manipulate tables/fields/indexes/relationships all from outside a dbs - in order to be able to update backends.

So one last problem.

When you create a relationship, the table with the foreign key gets a hidden index appended with a attribute of "foreign" set to TRUE.


Now, if this is a single column field, DAO/VBA seems to create the hidden index automatically, and then use it in the relationship.
However, with a muti-field index, I am getting an error that the index doesn't exist.

Does anyone know the correct syntax to add these fields


What I have is this

Code:
        rel.Fields.Append rel.createfield(rrst!relationfield)
        rel.Fields(rrst!relationfield).ForeignName = rrst!relationforeignfield
called twice, once for each field

AND THEN
Code:
        DB.Relations.Append rel


this is working fine for a single field index, but not for 2-field indexes. Any ideas?



[solved - i got the process slightly wrong]
 
Last edited:

Users who are viewing this thread

Back
Top Bottom