Wrox Programmer Forums
|
Access VBA Discuss using VBA for Access programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old August 31st, 2004, 02:37 PM
Registered User
 
Join Date: Jun 2004
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to relfst Send a message via Yahoo to relfst
Default Delete Query for entire table

I have created a table with a query from a much larger table in my database and now I want to delete the selected items from the entire database. Is there any way to create a delete query using two tables and just tell it to delete the 66 items in the smaller table from the 700 in the larger table? If there's not a query that will do it, is there any basic code that will work. I do not know code, so I would need some basic instruction on how to write it. Thank you for any help you can offer.
 
Old October 7th, 2004, 04:49 PM
Authorized User
 
Join Date: Oct 2003
Posts: 75
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I think I have your answer - here's the design for two tables
named Order_Extract and Order, both containing the exact same layout:

Column Names
 - ORDER_ID, Long
 - ORDER_DATE, Date/Time
 - SHIP_DATE, Date/Time

Assuming that you want to delete all entries from the Order
table that match in the Order_Extract table, here's the SQL that will do that:

DELETE FROM Order
WHERE ORDER_ID IN
(SELECT ORDER_ID FROM Order_Extract)

Let me know if you'd like to have the VBA code to do it
as well.

Hope that helps.





Similar Threads
Thread Thread Starter Forum Replies Last Post
php/mysql delete button and delete query dungey PHP Databases 17 April 11th, 2009 12:24 PM
delete query using trigger prashant_telkar SQL Language 1 June 19th, 2007 10:39 AM
Delete Query IanC2005 SQL Language 3 March 5th, 2006 09:56 PM
Delete Query Corey Access 2 February 12th, 2006 07:36 PM
Delete Table Teqlump Access 6 September 10th, 2004 04:25 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.