Re: Delete query constrained by join



Both tables need to have a unique index or primary key.

--
Steve Clark, Access MVP
FMS, Inc.
Call us for all of your Access Development Needs!
1-888-220-6234
Consulting@xxxxxxxxxx
www.fmsinc.com/consulting

"sean.howard" <sean.howard.1ujs2p@xxxxxxxxxxxxxxxxxx> wrote in message
news:sean.howard.1ujs2p@xxxxxxxxxxxxxxxxxxxxx
>
> I want to delete records from a table that are in a list represented by
> a subquery. Trying this in MS Access 2003 produced the following SQL:
>
> DELETE dbo_Products_CategoriesAssoc.*
> FROM dbo_Products_CategoriesAssoc, [Fix VTMM-5]
> WHERE (((dbo_Products_CategoriesAssoc.ProductID)=[fix
> VTMM-5].[productID]) AND
> ((dbo_Products_CategoriesAssoc.CategoryID)=[fix
> VTMM-5].[categoryID]));
>
> The [Fix VTMM-5] subquery is this:
>
> SELECT dbo_Products_CategoriesAssoc.ProductID,
> dbo_Products_CategoriesAssoc.CategoryID, dbo_Attributes.Attribute
> FROM (dbo_Products_AttributesAssoc INNER JOIN
> (dbo_Products_CategoriesAssoc INNER JOIN dbo_Categories ON
> dbo_Products_CategoriesAssoc.CategoryID = dbo_Categories.CategoryID) ON
> dbo_Products_AttributesAssoc.ProductID =
> dbo_Products_CategoriesAssoc.ProductID) INNER JOIN dbo_Attributes ON
> dbo_Products_AttributesAssoc.AttributeID = dbo_Attributes.AttributeID
> WHERE (((dbo_Attributes.Attribute) Not Like "*all*") AND
> ((dbo_Categories.Category) Like "*all*") AND
> ((dbo_Products_AttributesAssoc.TypeID)=5))
> ORDER BY dbo_Products_CategoriesAssoc.ProductID,
> dbo_Products_CategoriesAssoc.CategoryID;
>
>
> Viewing the list of records produces the correct recordset. However,
> when I run this query, I get an error message: "Could not delete from
> the specified table." I can't figure out why this doesn't work.
>
>
> --
> sean.howard
> ------------------------------------------------------------------------
> sean.howard's Profile: http://www.msusenet.com/member.php?userid=4759
> View this thread: http://www.msusenet.com/t-1871019383
>


.



Relevant Pages

  • Re: Incrementing nrs in a query
    ... > unless you are familiar with VBA, and calling functions from a query. ... > Steve Clark, Access MVP ... > FMS, Inc. ...
    (microsoft.public.access.queries)
  • Re: [OT] Reusable Query
    ... > Steve Clark, Access MVP ... > FMS, Inc. ... >> into the query where I would normally put the form name? ...
    (microsoft.public.access.queries)
  • Re: Field properties
    ... Steve Clark, Access MVP ... FMS, Inc. ... Prev by Date: ...
    (microsoft.public.access.queries)
  • Re: setting hot keys
    ... Steve Clark, Access MVP ... FMS, Inc. ... Call us for all of your Access Development Needs! ... > i want to generate soem hot keys, so that if a customer presses say F1, ...
    (microsoft.public.access.queries)
  • Re: Create New Query using OLE
    ... > What did you have in mind? ... > Steve Clark, Access MVP ... > FMS, Inc. ...
    (microsoft.public.access.queries)

Loading