473,545 Members | 1,983 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

INF: Cascade-to-Null relations are supported in JET 4

In Access 2000 and later, you can create a relation between tables where
related records can be automatically set to Null rather than deleted when
the primary record is deleted.

I have not seen anyone using or discussing this feature, so there is a new
article explaining the concept here:
Cascade to Null Relations
at:
http://allenbrowne.com/ser-64.html

--
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.
Jul 15 '06 #1
26 2069
Allen Browne wrote:
In Access 2000 and later, you can create a relation between tables where
related records can be automatically set to Null rather than deleted when
the primary record is deleted.

I have not seen anyone using or discussing this feature, so there is a new
article explaining the concept here:
Cascade to Null Relations
at:
http://allenbrowne.com/ser-64.html

Nice. Thanks for the great explanation. Any downsides?

--
'---------------
'John Mishefske
'---------------
Jul 15 '06 #2
No downsides, John.

I've been using this in real-world apps for more than 12 months now.

The only issue is the posssibility that the database is not rebuilt properly
by someone else, so the article addresses that maintenance question.

--
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.

"John Mishefske" <jm**********@S PAMyahoo.comwro te in message
news:ty******** *****@tornado.r dc-kc.rr.com...
Allen Browne wrote:
>In Access 2000 and later, you can create a relation between tables where
related records can be automatically set to Null rather than deleted when
the primary record is deleted.

I have not seen anyone using or discussing this feature, so there is a
new article explaining the concept here:
Cascade to Null Relations
at:
http://allenbrowne.com/ser-64.html


Nice. Thanks for the great explanation. Any downsides?

--
'---------------
'John Mishefske
'---------------

Jul 15 '06 #3
In Access 2000 and later, you can create a relation between tables
where related records can be automatically set to Null rather than
deleted when the primary record is deleted.

I have not seen anyone using or discussing this feature, so there is
a new article explaining the concept here:
Cascade to Null Relations
at:
http://allenbrowne.com/ser-64.html
It's also documented in the Jet SQL reference, see for instance the
help file on the constraint clause:

"Syntax
Single-field constraint:

CONSTRAINT name {PRIMARY KEY | UNIQUE | NOT NULL |
REFERENCES foreigntable [(foreignfield1, foreignfield2)]
[ON UPDATE CASCADE | SET NULL]
[ON DELETE CASCADE | SET NULL]}"

So, in your sample, you could fire it like any other Jet DDL through
ADO, too

Sub MakeRelJetADO()
Dim strSql As String
strSql = "ALTER TABLE tblProduct ADD CONSTRAINT FK_ProdCat " & _
"FOREIGN KEY (CategoryID) REFERENCES " & _
"tblCategor y (CategoryID) ON DELETE SET NULL"
CurrentProject. Connection.Exec ute strSql, , _
adExecuteNoReco rds + adCmdText
End Sub

--
Roy-Vidar
Jul 15 '06 #4
Thanks, Roy.

Yes, I should have included the DDL approach as well as the DAO and ADOX.
Done.

--
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.

"RoyVidar" <ro************ *@yahoo.nowrote in message
news:mn******** *************** @yahoo.no...
>In Access 2000 and later, you can create a relation between tables where
related records can be automatically set to Null rather than deleted when
the primary record is deleted.

I have not seen anyone using or discussing this feature, so there is a
new article explaining the concept here:
Cascade to Null Relations
at:
http://allenbrowne.com/ser-64.html

It's also documented in the Jet SQL reference, see for instance the
help file on the constraint clause:

"Syntax
Single-field constraint:

CONSTRAINT name {PRIMARY KEY | UNIQUE | NOT NULL |
REFERENCES foreigntable [(foreignfield1, foreignfield2)]
[ON UPDATE CASCADE | SET NULL]
[ON DELETE CASCADE | SET NULL]}"

So, in your sample, you could fire it like any other Jet DDL through
ADO, too

Sub MakeRelJetADO()
Dim strSql As String
strSql = "ALTER TABLE tblProduct ADD CONSTRAINT FK_ProdCat " & _
"FOREIGN KEY (CategoryID) REFERENCES " & _
"tblCategor y (CategoryID) ON DELETE SET NULL"
CurrentProject. Connection.Exec ute strSql, , _
adExecuteNoReco rds + adCmdText
End Sub

Jul 15 '06 #5
John Mishefske wrote:
Allen Browne wrote:
In Access 2000 and later, you can create a relation between tables
where related records can be automatically set to Null rather than
deleted when the primary record is deleted.

I have not seen anyone using or discussing this feature, so there
is a new article explaining the concept here:
Cascade to Null Relations
at:
http://allenbrowne.com/ser-64.html


Nice. Thanks for the great explanation. Any downsides?
The database on our AS400 has had this for some time now. I fail to see any
circumstance where one would ever want that behavior though. Do you have an
example where it makes sense?

--
Rick Brandt, Microsoft Access MVP
Email (as appropriate) to...
RBrandt at Hunter dot com
Jul 15 '06 #6
On Sat, 15 Jul 2006 10:05:42 +0800, "Allen Browne" <Al*********@Se eSig.Invalidwro te:
>In Access 2000 and later, you can create a relation between tables where
related records can be automatically set to Null rather than deleted when
the primary record is deleted.

I have not seen anyone using or discussing this feature, so there is a new
article explaining the concept here:
Cascade to Null Relations
at:
http://allenbrowne.com/ser-64.html
Allen, can this be done in a similar way in SQL-server? Will upsizing handle it?
Jul 15 '06 #7
On Sat, 15 Jul 2006 11:44:38 GMT, "Rick Brandt" <ri*********@ho tmail.comwrote:
>John Mishefske wrote:
>Allen Browne wrote:
In Access 2000 and later, you can create a relation between tables
where related records can be automatically set to Null rather than
deleted when the primary record is deleted.

I have not seen anyone using or discussing this feature, so there
is a new article explaining the concept here:
Cascade to Null Relations
at:
http://allenbrowne.com/ser-64.html


Nice. Thanks for the great explanation. Any downsides?

The database on our AS400 has had this for some time now. I fail to see any
circumstance where one would ever want that behavior though. Do you have an
example where it makes sense?
I expected this question (less politely) from David Fenton :)
Jul 15 '06 #8
Haven't experimented.

Perhaps someone who has can comment.

--
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.

"polite person" <sn**@snippers. comwrote in message
news:qa******** *************** *********@4ax.c om...
On Sat, 15 Jul 2006 10:05:42 +0800, "Allen Browne"
<Al*********@Se eSig.Invalidwro te:
>>In Access 2000 and later, you can create a relation between tables where
related records can be automatically set to Null rather than deleted when
the primary record is deleted.

I have not seen anyone using or discussing this feature, so there is a new
article explaining the concept here:
Cascade to Null Relations
at:
http://allenbrowne.com/ser-64.html

Allen, can this be done in a similar way in SQL-server? Will upsizing
handle it?

Jul 15 '06 #9
The examples where I find this really useful are those discussed in the
article: operations where a child record (such as a weighbridge docket or
donation) later becomes a child of another parent (such as a monthly account
or thank-you letters), and the batch undo needs to return the 2nd foreign
key to null.

But any non-required foreign key field (such as items that can be
uncategorized) is a candidate.

--
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.

"Rick Brandt" <ri*********@ho tmail.comwrote in message
news:Gy******** ***********@new ssvr27.news.pro digy.net...
John Mishefske wrote:
>Allen Browne wrote:
In Access 2000 and later, you can create a relation between tables
where related records can be automatically set to Null rather than
deleted when the primary record is deleted.

I have not seen anyone using or discussing this feature, so there
is a new article explaining the concept here:
Cascade to Null Relations
at:
http://allenbrowne.com/ser-64.html


Nice. Thanks for the great explanation. Any downsides?

The database on our AS400 has had this for some time now. I fail to see
any circumstance where one would ever want that behavior though. Do you
have an example where it makes sense?

--
Rick Brandt, Microsoft Access MVP
Email (as appropriate) to...
RBrandt at Hunter dot com

Jul 15 '06 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
27003
by: Vijay Singh | last post by:
What is META-INF directory for ?
6
2315
by: Richard Barnet | last post by:
Dear CSS gurus, My question regarding 'the cascade' is a simple one, but one that I haven't heard anyone talk about before: When cascading (for instance, when applying two linked stylesheets), does the whole selector definition supercede and replace a previous one, or does it go through the selector definition line by line (rule by rule)...
2
6984
by: Jack | last post by:
We are have a question about the no cascade option on before triggers. The description stays that no other triggers will be fired by the changes of a before trigger. One of our developers is seeing results that would imply that other after triggers are being fired by the results of a before trigger. Is this possible? Is there some little...
3
4412
by: Kumar | last post by:
Hi, I have a table (TAB1) withi has 4 child tables on COL1 with DELETE CASCADE. When I delete any row in TAB1, it will delete corresponding rows on all child tables. SQL : delete from TAB1 where COL1 = 21
0
954
by: JH | last post by:
How do you run and INF file from VB.NET Can I use 'System.Diagnostics.Process.Start' ? Thanks
0
1041
by: JH | last post by:
I can install an 'INF' file by just right clicking and choosing 'Install ' option. How can I do this programmatically in VB.NET? Thanks
2
23606
by: geetareddy | last post by:
What META-INF and WEB-INF contains.
3
7324
by: sonia.sardana | last post by:
Que-What is the use of CASCADE CONSTRAINTS? Ans-When this clause is used with the DROP command, a parent table can be dropped even when a child table exists. Example create table primary1(roll int primary key,name varchar) insert into primary1 values(1,'A') insert into primary1 values(2,'B') select * from primary1
1
3826
by: akansha1234 | last post by:
Hi all, I am facing this problem. When i am building my workspace in eclipse i am getting following exception its very urgent.. 0000004c SystemErr R *** ERROR ***: Fri Sep 12 03:53:38 CDT 2008 com.ibm.etools.j2ee.commonarchivecore.exception.OpenFailureException: IWAE0034E Could not open the nested archive "\WEB-INF\lib" in...
1
2380
by: JOHNSHELL08 | last post by:
Dear Team, there is a problem with 2fiji.com and autorun.inf virus. this is always present in my pendrive while i am using my updated mcafee so can you help me for removing the same.
0
7479
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7669
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7773
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
5987
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5343
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3468
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
1901
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1028
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
722
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.