Dear Sir, In my database I am relating tales & I select enforce referential integrity and I select cascade delete related record. In my application I delete record from parent table so because of cascade delete it is deleting from child table. It works fine but I found in some case under network it is deleting table from parent but not from child !!! If I compact database then it breaks relationship of parent & child and then it is very difficult to delete record from child. If I had defined referential integrity & cascade delete then it must delete record from child when I compact database. Please any one tell me why this is happening & what is solution. ? Thanks, Sanjay Shah
When using a "JET" file share, then any minor disconnecting in your network, poor cabling, interference from machinery, or even wireless networks are all sources that can easily damaged a jet based file system. You have to have a very solid high quality network to use a jet file share system. Anything else but a high quality functioning network is going to be subject to frequent damage to your database file. Some sources and ways to avoid corruption is mentioned here: http://www.granite.ab.ca/access/corruptmdbs.htm I also explain using pictures and diagrams as to why corruption occurs. If you are a visual type thinking person, then read the following article as it explains why corruption occurs when you have a minor glitch or disconnect in your network: http://www.members.shaw.ca/AlbertKallal//Wan/Wans.html -- Albert D. Kallal (Access MVP) Edmonton, Alberta Canada pleaseNOOSpamKallal@msn.com
"SANJAY SHAH-MICROBRAIN COMPUTERS PVT. LTD." wrote: >In my database I am relating tales & I select enforce referential integrity >and I select cascade delete related record. > >In my application I delete record from parent table so because of cascade >delete it is deleting from child table. It works fine but I found in some >case under network it is deleting table from parent but not from child !!! I never use cascade deletes as I prefer to handle this myself in the few situations where this happens. I would delete the child records and then the parent records in code. Code something like dim strsql as string strsql = "Delete * from ChildTable where ParentForeignKeyID=" & _ me.parentid. currentdb.execute strsql, dbfailonerror strsql = "Delete * from ParentTable where ID=" & me.parentid. currentdb.execute strsql, dbfailonerror Tony -- Tony Toews, Microsoft Access MVP Please respond only in the newsgroups so that others can read the entire thread of messages. Microsoft Access Links, Hints, Tips & Accounting Systems at http://www.granite.ab.ca/accsmstr.htm Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/
I'd consider wrapping _ALL_ of that into a single transaction. -Aaron On May 10, 4:02 pm, "Tony Toews [MVP]" wrote: > "SANJAY SHAH-MICROBRAIN COMPUTERS PVT. LTD." > wrote: > > >In my database I am relating tales & I select enforce referential integrity > >and I select cascade delete related record. > > >In my application I delete record from parent table so because of cascade> >delete it is deleting from child table. It works fine but I found in some> >case under network it is deleting table from parent but not from child !!> I never use cascade deletes as I prefer to handle this myself in the > few situations where this happens. > > I would delete the child records and then the parent records in code. > > Code something like > > dim strsql as string > > strsql = "Delete * from ChildTable where ParentForeignKeyID=" & _ > me.parentid. > currentdb.execute strsql, dbfailonerror > > strsql = "Delete * from ParentTable where ID=" & me.parentid. > currentdb.execute strsql, dbfailonerror > > Tony > --TonyToews, Microsoft Access MVP > Please respond only in the newsgroups so that others can > read the entire thread of messages. > Microsoft Access Links, Hints, Tips & Accounting Systems athttp://www.granite.ab.ca/accsmstr.htm > Tony'sMicrosoft Access Blog -http://msmvps.com/blogs/access/