Re: SQL Delete Function
From: John Vinson (jvinson_at_STOP_SPAM.WysardOfInfo.com)
Date: 03/03/05
- Next message: ASP Yaboh: "How do I get to the code in .mdb"
- Previous message: Samora: "RE: COMBOBOX - RECORDS IN TABLE"
- In reply to: Andi B: "SQL Delete Function"
- Next in thread: Justin Hoffman: "Re: SQL Delete Function"
- Messages sorted by: [ date ] [ thread ]
Date: Wed, 02 Mar 2005 17:40:36 -0700
On Wed, 2 Mar 2005 22:20:25 -0000, "Andi B" <mgem35@dsl.pipex.com>
wrote:
>Hi everyone!
>
>I'm looking for a little help with a database I'm creating:
>
>Every a spreadsheet containing some orderbook information is imported into
>an access database, overwriting the information from the previous week. The
>spreadsheet contains duplicate entries for some lines however. After
>importing the data, a macro runs a query that displays all lines that are
>duplicates, and all but one of each must be manually deleted before the
>database can be used correctly. In order to remove the need to do this
>manually I was wondering if it would be possible to use a delete query to
>remove all but one of each of the duplicate records. I have created a
>prototype query, but when run it deletes all the duplicate entries. Any
>advice on what I can do to achieve my aim?
>
>Thanks in advance,
>
>Andi
>
I'd suggest having a permanent table with a unique Index on the
combination of fields which define a duplicate. Rather than importing
into a new table, import into this table and use SetWarnings to
suppress the error message "x records were not added due to key
violations". Run a Delete query
DELETE * FROM localtable;
before running the append.
John W. Vinson[MVP]
- Next message: ASP Yaboh: "How do I get to the code in .mdb"
- Previous message: Samora: "RE: COMBOBOX - RECORDS IN TABLE"
- In reply to: Andi B: "SQL Delete Function"
- Next in thread: Justin Hoffman: "Re: SQL Delete Function"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|