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 January 5th, 2011, 10:08 PM
Registered User
 
Join Date: Dec 2010
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default Thanks

I finally got this to work. I decided to pull all data out of the Order_Number Field that was text, change the field to number and set it as the primary key in both tables, therefore creating a key that can be joined that will link to indentical records in both tables. The code I then used is as follows:
Code:
Dim SQL As String

SQL = "DELETE Sheet1.*" & _
          " FROM Sheet1 " & _
           " INNER JOIN tbl_OrderInfo ON Sheet1.[Order #] = tbl_OrderInfo.fld_Order_Number "

      
DoCmd.RunSQL SQL
ran the code and it deleted the correct records.

Again thanks for all your help
 
Old January 6th, 2011, 01:02 AM
Friend of Wrox
 
Join Date: Sep 2010
Posts: 245
Thanks: 5
Thanked 24 Times in 23 Posts
Default

Glad to here that you got it working!
__________________
Boyd Trimmell aka HiTechCoach (.com)
Microsoft Access MVP Alumni 2010-2015





Similar Threads
Thread Thread Starter Forum Replies Last Post
Using DoCmd.RunSQL to return values jscully Access VBA 10 August 21st, 2017 12:58 PM
Docmd.RunSQL Armand elia BOOK: Access 2003 VBA Programmer's Reference 0 June 17th, 2009 03:47 PM
Docmd.runsql anne.burrows VB How-To 2 October 25th, 2006 08:21 AM
docmd.runsql "select RodMead Access VBA 2 July 31st, 2004 02:55 PM
Help with DoCmd.RunSQL command ricmar Access VBA 3 July 21st, 2004 03:32 PM





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