Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Database Design / December 2004

Tip: Looking for answers? Try searching our database.

Join/delete problem

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Carol Giannini - 30 Nov 2004 22:23 GMT
I have a join problem I can't figure out.  I have two back-end databases
joined on their control numbers through a front-end query (db2 on the left,
db1 on the right).  No other relationships exist between these tables.  The
control number for db1 is a primary key; the control number for db2 is not.  
Db2 is a very small subset of db1, and the form used to fill in db2 displays
some relevant info from db1.  Users have to manually enter db2 control
numbers; there's no error checking in place, but records should include only
numbers that are already in db1.  The db2 control number is currently set to
index/duplicates okay, because it was originally anticipated that there would
be duplicate records in db2 for each record in db1.  Now I've been asked to
prevent duplicates.  I thought I could simply set the db2 control number to
index/no duplicates.  But when I do that, deleting a record from db2 also
deletes the record from db1 that has the same control number, which I don't
want it to do.  Is it the query relationship that's causing this?  I think
I'm missing something really obvious.
John Vinson - 30 Nov 2004 23:59 GMT
>But when I do that, deleting a record from db2 also
>deletes the record from db1 that has the same control number, which I don't
>want it to do.  Is it the query relationship that's causing this?

Check the relationship in the Relationships window: click the line and
view its properties. If the "Cascade Deletes" checkbox is checked,
uncheck it.

                 John W. Vinson[MVP]    
            Join the online Access Chats
       Tuesday 11am EDT - Thursday 3:30pm EDT
     http://community.compuserve.com/msdevapps
Carol Giannini - 01 Dec 2004 19:33 GMT
John - thanks, but this is why I'm confused.  There are no properties in the
relationships windows.  These tables are joined *only* through a query, and
referential integrity isn't a choice there.  

> >But when I do that, deleting a record from db2 also
> >deletes the record from db1 that has the same control number, which I don't
[quoted text clipped - 8 lines]
>         Tuesday 11am EDT - Thursday 3:30pm EDT
>       http://community.compuserve.com/msdevapps
John Vinson - 01 Dec 2004 21:15 GMT
>John - thanks, but this is why I'm confused.  There are no properties in the
>relationships windows.  These tables are joined *only* through a query, and
>referential integrity isn't a choice there.  

Are you sure the record is in fact being deleted from both tables? If
it exists only in one of the two tables (either one), it will NOT show
up in a Query joining the two tables by the default Inner Join.

                 John W. Vinson[MVP]    
            Join the online Access Chats
       Tuesday 11am EDT - Thursday 3:30pm EDT
     http://community.compuserve.com/msdevapps
Carol Giannini - 02 Dec 2004 21:45 GMT
Yes.  I've manually checked both tables, and when the delete is done in the
first, the corresponding record is also deleted from the second.

> >John - thanks, but this is why I'm confused.  There are no properties in the
> >relationships windows.  These tables are joined *only* through a query, and
[quoted text clipped - 8 lines]
>         Tuesday 11am EDT - Thursday 3:30pm EDT
>       http://community.compuserve.com/msdevapps
John Vinson - 03 Dec 2004 04:06 GMT
> But when I do that, deleting a record from db2 also
>deletes the record from db1 that has the same control number, which I don't
>want it to do.  Is it the query relationship that's causing this?  I think
>I'm missing something really obvious.

If the FOrm is based on a query with a one-to-one relationship, it may
be deleting both records. Is that the case? It might be safer to have
a Form with a Subform, or to do the deletion in code.

                 John W. Vinson[MVP]    
            Join the online Access Chats
       Tuesday 11am EDT - Thursday 3:30pm EDT
     http://community.compuserve.com/msdevapps
Carol Giannini - 03 Dec 2004 22:55 GMT
It is a query with a one-to-one.  This is the answer.  Thanks *very* much.

> It might be safer to .. do the deletion in code.
>
>                   John W. Vinson[MVP]    
>              Join the online Access Chats
>         Tuesday 11am EDT - Thursday 3:30pm EDT
>       http://community.compuserve.com/msdevapps
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.