473,437 Members | 1,773 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,437 software developers and data experts.

Changing relations with VBA code?

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
5 2134
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
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
"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
"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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: G-Fit | last post by:
Hello group, I have several servers hosting SQL databases. On each of them, I have several databases. All those databases have the same structure (even those on different servers), only the data...
2
by: DelphiBlue | last post by:
I have a Nested Datagrid that is using a data relations to tie the parent child datagrids together. All is working well with the display but I am having some issues trying to sort the child...
1
by: Jef De Rycke | last post by:
Hi access group, I have written code to create relations between tables according to a corresponding relations information table. At first I thought my code was not working properly because...
0
by: Joe Van Meer | last post by:
Hi all, I have a question regarding data relations within a data set. Say I have 3 tables named CLIENT, BOOKING and EMPLOYEE and I wanted to relate the first two tables (CLIENT AND BOOKING)...
1
by: Ravi | last post by:
I am trying to represent master-detail records from a database The general logic will be populating the first dropdownlist with the master records and on change of the first dropdownlis getting...
2
by: Joe | last post by:
Hi I have a dataset with 3 tables and 2 relations Is there a way to when I am at 1 row to tell if there is a relation on that row ??? I have the code hardcoded but try to make it work if the #...
5
by: G .Net | last post by:
Hi I'm hoping that somebody can help me with a fairly puzzling problem. I've created some DataTables which have relations between them e.g. one to many. In the application, I want to remove...
3
by: john | last post by:
I have a form with Members and in that form a subform with Transactions. Those are linked (on banknr) 1xM which I've set in the database relations. Now I would like to copy the form and modify it....
14
by: kjewell23 | last post by:
Hi. I have the code working just fine except all the data isn't coming up with the ds.relations code. Could you see what I'm doing wrong or what else I need to add. Code down below Dim adapter As...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.