I have tried to make a special command (non-DDL) that can be used to ask DAO
to make the Index unique.
Public Sub makeIndexUnique(dbConnection As Database, SQL As String)
Dim tableDefinition As TableDef
Dim indexDefinition As Index
Dim tableName As String
Dim indexName As String
Dim commandArgs As Collection
Set commandArgs = argumentsOfCommandAsCollection(SQL)
tableName = commandArgs(1)
indexName = commandArgs(2)
Set tableDefinition = dbConnection.TableDefs(tableName)
Set indexDefinition = tableDefinition.Indexes(indexName)
indexDefinition.Unique = True
End Sub
This however does not work, throwing an error at the last line, saying the
index's unique property cannot be modified.
Any other possibilities? :'(
Jonathan Scott
Jonathan Scott wrote:
I have an application who's backend has a relationship defined one to one. I
need to update the LIVE version of the database to reflect this for the new
version. How can I express such a foreign key constraint in DDL? I tried
creating a foreign key constraint, and then making a unique index on the
field in the foreign table, and vice versa, and neither has worked. My schema
diff utility tells me there is still a one to many relationship at the end of
the update.
Any help would be highly appreciated!
Jonathan Scott
--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...ccess/200508/1