By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,504 Members | 1,194 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,504 IT Pros & Developers. It's quick & easy.

Changing relations with VBA code?

P: n/a
Hi

I'm running Access 2000, using DAO.

According to the Object Browser, each member of the Relations collection has
a property, Attributes. This value appears to be a bitmask, formed by
ANDing various constants which denote the properties of that relation:
"Enforce Referential Integrity", "Cascade Updated Fields", etc.

This property is not marked as Read Only and yet I can't find a way of
modifying it using VBA.

Can anyone advise me on this?

Thanks
Dec 13 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a
On Tue, 13 Dec 2005 12:41:11 GMT, "Captain Nemo" <ne**@nospam.com>
wrote:

It's actually ORing together:
set rel = db.CreateRelation("relation5", "sometable",
"someothertable", dbRelationUpdateCascade Or dbRelationDeleteCascade)

-Tom.

Hi

I'm running Access 2000, using DAO.

According to the Object Browser, each member of the Relations collection has
a property, Attributes. This value appears to be a bitmask, formed by
ANDing various constants which denote the properties of that relation:
"Enforce Referential Integrity", "Cascade Updated Fields", etc.

This property is not marked as Read Only and yet I can't find a way of
modifying it using VBA.

Can anyone advise me on this?

Thanks


Dec 13 '05 #2

P: n/a
The property is a bitmask, but I don't believe you can alter it once the
relation has been created.

AFAIK, you have to delete the relation and recreate it to change the
attribute.

BTW, bit 8192 is not documented, but seems to represent the Cascade-to-Null
relation (where relational integrity it maintained by setting the foreign
key to null when the primary record is deleted.)

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Captain Nemo" <ne**@nospam.com> wrote in message
news:Hj*****************@text.news.blueyonder.co.u k...

I'm running Access 2000, using DAO.

According to the Object Browser, each member of the Relations collection
has
a property, Attributes. This value appears to be a bitmask, formed by
ANDing various constants which denote the properties of that relation:
"Enforce Referential Integrity", "Cascade Updated Fields", etc.

This property is not marked as Read Only and yet I can't find a way of
modifying it using VBA.

Dec 13 '05 #3

P: n/a
"Tom van Stiphout" <no*************@cox.net> wrote in message
news:q7********************************@4ax.com...
On Tue, 13 Dec 2005 12:41:11 GMT, "Captain Nemo" <ne**@nospam.com>
wrote:

It's actually ORing together:


Yes, I realised that after I'd posted! You use AND to test and OR to
combine.
Dec 13 '05 #4

P: n/a
"Allen Browne" <Al*********@SeeSig.Invalid> wrote in message
news:43**********************@per-qv1-newsreader-01.iinet.net.au...
The property is a bitmask, but I don't believe you can alter it once the
relation has been created.

AFAIK, you have to delete the relation and recreate it to change the
attribute.


Yes, I had a nasty feeling that might be the case. In fact I've already
started work on the code to do just that.

Dec 13 '05 #5

P: n/a
You might want to get my free utility
(http://home.gci.net/~mike-noel/CompareEM.htm) to write the code for
you. Just do a 'before' and 'after' version of the database and let it
write the code to go from one to the other...

Captain Nemo wrote:
"Allen Browne" <Al*********@SeeSig.Invalid> wrote in message
news:43**********************@per-qv1-newsreader-01.iinet.net.au...
The property is a bitmask, but I don't believe you can alter it once the
relation has been created.

AFAIK, you have to delete the relation and recreate it to change the
attribute.

Yes, I had a nasty feeling that might be the case. In fact I've already
started work on the code to do just that.

Dec 13 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.