Results 1 to 2 of 2
  1. #1
    tylerg11 is offline Competent Performer
    Windows 7 64bit Access 2007
    Join Date
    Sep 2011
    Posts
    200

    VBA Delete record

    Hi,

    I need to delete records from a table using SQL within VBA such as the following.



    Code:
    CurrentDB.Execute "DELETE FROM dbo_LeadNote WHERE CompanyCode = " & Me.CompanyCode
    My problem is that I have linked tables from two different databases. So rather than using CurrentDB what should I use to specify the database?

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    If the tables are linked it wouldn't matter. It will delete from the linked table named "dbo_LeadNote" regardless of where that table actually resides (or what its actual name is).
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 4
    Last Post: 10-02-2013, 04:14 PM
  2. Replies: 4
    Last Post: 07-03-2013, 10:02 AM
  3. Replies: 12
    Last Post: 10-27-2012, 05:44 AM
  4. Replies: 3
    Last Post: 10-19-2012, 04:30 PM
  5. Trying to Delete record using delete query
    By MooseOTL in forum Access
    Replies: 13
    Last Post: 10-04-2011, 02:30 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums