P
PeteCresswell
I'm creating some relationships via code.
End product looks like this: http://tinyurl.com/4ku6w5
I would prefer to have it look like this: http://tinyurl.com/3rj87y
I'm assuming that the two representations are functionally identical,
so it's not a religious issue, just a visual nice-to-have.
Code looks like this (with apologies in advance for the wrapping):
'
--------------------------------------------------------------------------------
' CREATE RELATIONSHIPS the TradingAccountProperty-related tables
' ---------------------------------------
' tblTradingAccountPropertyValue==tlkpTradingAccountPropertyType
on TradingAccountPropertyTypeID
1650 curName = "TradingAccountPropertyTypeID"
1651 Set curRelation =
CurrentDb.CreateRelation("tlkpTradingAccountPropertyTypetblTradingAccountPropertyValue",
"tlkpTradingAccountPropertyType", "tblTradingAccountPropertyValue")
1652 With curRelation
1653 .Fields.Append curRelation.CreateField(curName)
1654 .Fields(curName).ForeignName = curName
1655 End With
1659 targetDB.Relations.Append curRelation
' ---------------------------------------
'
tblTradingAccount==tblTradingAccountTradingAccountPropertyValue on
TradingAccountID
1660 curName = "TradingAccountID"
1661 Set curRelation =
CurrentDb.CreateRelation("tblTradingAccounttblTradingAccountTradingAccountPropertyValue",
"tblTradingAccount", "tblTradingAccountTradingAccountPropertyValue",
dbRelationLeft)
1662 With curRelation
1663 .Fields.Append curRelation.CreateField(curName)
1664 .Fields(curName).ForeignName = curName
1665 End With
1669 targetDB.Relations.Append curRelation
' ---------------------------------------
'
tblTradingAccountTradingAccountPropertyValue==tblTradingAccountPropertyValue
on TradingAccountPropertyTypeID
1670 curName = "TradingAccountPropertyTypeID"
1671 Set curRelation =
CurrentDb.CreateRelation("TradingAccountPropType",
"tblTradingAccountPropertyValue",
"tblTradingAccountTradingAccountPropertyValue", dbRelationDontEnforce)
1672 With curRelation
1673 .Fields.Append curRelation.CreateField(curName)
1674 .Fields(curName).ForeignName = curName
1675 End With
1679 targetDB.Relations.Append curRelation
' ---------------------------------------
'
tblTradingAccountTradingAccountPropertyValue==tblTradingAccountPropertyValue
on TradingAccountPropertyValueID
1680 curName = "TradingAccountPropertyValueID"
1681 Set curRelation =
CurrentDb.CreateRelation("TradingAccountPropValue",
"tblTradingAccountPropertyValue",
"tblTradingAccountTradingAccountPropertyValue", dbRelationDontEnforce)
1682 With curRelation
1683 .Fields.Append curRelation.CreateField(curName)
1684 .Fields(curName).ForeignName = curName
1685 End With
1689 targetDB.Relations.Append curRelation
'
--------------------------------------------------------------------------------
End product looks like this: http://tinyurl.com/4ku6w5
I would prefer to have it look like this: http://tinyurl.com/3rj87y
I'm assuming that the two representations are functionally identical,
so it's not a religious issue, just a visual nice-to-have.
Code looks like this (with apologies in advance for the wrapping):
'
--------------------------------------------------------------------------------
' CREATE RELATIONSHIPS the TradingAccountProperty-related tables
' ---------------------------------------
' tblTradingAccountPropertyValue==tlkpTradingAccountPropertyType
on TradingAccountPropertyTypeID
1650 curName = "TradingAccountPropertyTypeID"
1651 Set curRelation =
CurrentDb.CreateRelation("tlkpTradingAccountPropertyTypetblTradingAccountPropertyValue",
"tlkpTradingAccountPropertyType", "tblTradingAccountPropertyValue")
1652 With curRelation
1653 .Fields.Append curRelation.CreateField(curName)
1654 .Fields(curName).ForeignName = curName
1655 End With
1659 targetDB.Relations.Append curRelation
' ---------------------------------------
'
tblTradingAccount==tblTradingAccountTradingAccountPropertyValue on
TradingAccountID
1660 curName = "TradingAccountID"
1661 Set curRelation =
CurrentDb.CreateRelation("tblTradingAccounttblTradingAccountTradingAccountPropertyValue",
"tblTradingAccount", "tblTradingAccountTradingAccountPropertyValue",
dbRelationLeft)
1662 With curRelation
1663 .Fields.Append curRelation.CreateField(curName)
1664 .Fields(curName).ForeignName = curName
1665 End With
1669 targetDB.Relations.Append curRelation
' ---------------------------------------
'
tblTradingAccountTradingAccountPropertyValue==tblTradingAccountPropertyValue
on TradingAccountPropertyTypeID
1670 curName = "TradingAccountPropertyTypeID"
1671 Set curRelation =
CurrentDb.CreateRelation("TradingAccountPropType",
"tblTradingAccountPropertyValue",
"tblTradingAccountTradingAccountPropertyValue", dbRelationDontEnforce)
1672 With curRelation
1673 .Fields.Append curRelation.CreateField(curName)
1674 .Fields(curName).ForeignName = curName
1675 End With
1679 targetDB.Relations.Append curRelation
' ---------------------------------------
'
tblTradingAccountTradingAccountPropertyValue==tblTradingAccountPropertyValue
on TradingAccountPropertyValueID
1680 curName = "TradingAccountPropertyValueID"
1681 Set curRelation =
CurrentDb.CreateRelation("TradingAccountPropValue",
"tblTradingAccountPropertyValue",
"tblTradingAccountTradingAccountPropertyValue", dbRelationDontEnforce)
1682 With curRelation
1683 .Fields.Append curRelation.CreateField(curName)
1684 .Fields(curName).ForeignName = curName
1685 End With
1689 targetDB.Relations.Append curRelation
'
--------------------------------------------------------------------------------