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 / Queries / March 2008

Tip: Looking for answers? Try searching our database.

delete query with 2 tables

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
bsacks - 28 Mar 2008 18:59 GMT
I have a query that has 2 tables linked (one to many). Access won’t let me
create a delete query from this – it give me a message that I need to choose
the table to delete from. Can you help me?

I am an intermediate user - I do not know SQL.

thanks,

Brandy
Tom Lake - 28 Mar 2008 19:17 GMT
>I have a query that has 2 tables linked (one to many). Access won’t let me
> create a delete query from this – it give me a message that I need to choose
[quoted text clipped - 3 lines]
>
> thanks,

In your Relationship between the two, you should have Cascade Deletes turned on.
Then you make the Delete query from the One side table only.  The related records
in the Many side will be deleted automatically.

Tom Lake
bsacks - 31 Mar 2008 18:52 GMT
> >I have a query that has 2 tables linked (one to many). Access won’t let me
> > create a delete query from this – it give me a message that I need to choose
[quoted text clipped - 9 lines]
>
> Tom Lake

Hi Tom,

Thanks for the reply. I have turned Cascade Delete on. How (exactly) do i
make the delete query from one side table only?

thanks!
John W. Vinson - 28 Mar 2008 23:36 GMT
>I have a query that has 2 tables linked (one to many). Access won’t let me
>create a delete query from this – it give me a message that I need to choose
[quoted text clipped - 5 lines]
>
>Brandy

You need to be sure you only specify one table in the DELETE clause. In the
query grid, there should be one or more fields with "From" and one or more
other fields with "Where" - select the * pseudo-field from the table from
which you want to delete records in the FROM column, and put any fields from
the other table in the WHERE column(s).

The SQL view of the query would resemble

DELETE TableA.*
FROM TableA INNER JOIN TableB
ON <whatever>
WHERE TableB.field = something

If this doesn't help, please open the Delete query; select View... SQL; and
post the SQL text here.
Signature


            John W. Vinson [MVP]

 
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.