Re: Compare 2 files and delete

From: Ted Allen (anonymous_at_discussions.microsoft.com)
Date: 03/31/04


Date: Wed, 31 Mar 2004 08:12:13 -0800

If you are working with the query builder, once the query
is changed to a delete query there will be a row
titled "Delete". The options on this row are "From"
and "Where". Select "From" below a field from the table
that you want to delete the records from, and
select "Where" beneath any fields from other tables that
you want to use to specify criteria to restrict the
deletions from the "From" table.

Hope this helps.

-Ted Allen
>-----Original Message-----
>John,
>
> Once I change the below query (Which seems to work
>Beautifully) to a delete query, and I run the delete
query
>Access asks to "specify the table containing the records
>you want to delete". 1)How can I do that? and 2)I can
>uncheck the show box in a select query then convert it
to
>a delete query(Which does not offer the option)but the
>field still shows up in the query result, is that a
>problem?
>
>Thanks,
>
>Dennis
>
>>-----Original Message-----
>>On Tue, 30 Mar 2004 19:21:55 -0800, "Dennis"
>><anonymous@discussions.microsoft.com> wrote:
>>
>>>I need to compare two files then delete records in one
>>>file that do not have a matching records in the other.
I
>>>have tried a couple of ideas but I have not been able
to
>>>figure out how to do it. I can compare the two files
in
>>>append wizard but not in the delete wizard. It seems I
>>>need to combine the two functions? Does anyone have
any
>>>examples of how I can do this?
>>>
>>>Thanks Dennis
>>
>>First off - they're not "files", they're Tables. Jargon
>can be
>>confusing!
>>
>>You'll need to build the query yourself; the wizards
are
>pretty
>>limited. I assume that both tables have the same
Primary
>Key field,
>>and that matching primary keys is sufficient to
>identify "matching
>>records".
>>
>>First, back up your database - any time you do a mass
>delete there's a
>>risk you'll delete too much!
>>
>>If so, create a Query joining the two tables by that
>field. Select the
>>Join line and choose option 2 or 3 - "Show all records
in
><the table
>>you want to delete from> and matching records in <the
>other table>".
>>
>>Select only the joining field from the second table.
Put
>a criterion
>>on it of IS NULL.
>>
>>Open the query to make sure that these are in fact the
>records you
>>want to delete. If so, change the query to a DELETE
>query, and uncheck
>>the Show box under the field with the "is null"
criterion.
>>
>>The SQL will be something like
>>
>>DELETE * FROM tableA LEFT JOIN tableB
>>ON tableA.ID = tableB.ID
>>WHERE TableB.ID IS NULL;
>>
>> John W. Vinson[MVP]
>> Come for live chats every Tuesday and Thursday
>>http://go.compuserve.com/msdevapps?loc=us&access=public
>>.
>>
>.
>



Relevant Pages

  • Re: More Specific Access Performance Questions
    ... > all query criteria fields and join fields indexed: ... say you have a join of two tables and a criterion on ... > Is it OK to have a simple criteria of fulfillment status = false ... I used to do saved queries for these things, ...
    (comp.databases.ms-access)
  • RE: Filter list box by text box
    ... The criterion goes in the query that's bound to the list form. ... need is a button with the single command "DoCmd.Requery" - type tyhe name ... The form have many text boxes. ...
    (microsoft.public.access.formscoding)
  • Re: Only one parameter
    ... "Jeff Boyce" wrote: ... Modify the querythat feed the report so that, ... as a criterion, you have something like: ... use this SAME criterion for every query that now gets the [Enter ...
    (microsoft.public.access.queries)
  • RE: Embeded Sub Forms
    ... "Find_SerialNo" in the Query SerialNo Criterion to find the record. ... content of "Find_SerialNo" is indeed a String., ...
    (microsoft.public.access.gettingstarted)
  • Re: Defualt Value using a Query
    ... You can't have a default value appear when you use a simple parameter query. ... as the criterion in your Query. ... It's convenient to base a second Form or Report on the resulting query to ... When i run the Query i would like a default value to apear in the text box ...
    (microsoft.public.access.queries)