Results 1 to 2 of 2
  1. #1
    Join Date
    Feb 2012
    Posts
    108
    Provided Answers: 1

    Unanswered: Delete From Table In Another Database Using Variable

    Hi all,

    Using Access 2007

    I tried assigning path and db name to a strVariable and using the string variable in my SQL:

    Code:
         strDBPath = "mypath\mydb.accdb"
    
        'Step 1: Clear old data from tables
         strSQL = "DELETE FROM tbl IN strDBPath;"
         CurrentDb.Execute strSQL, dbFailOnError
    But I receive this error
    Run-time error '3024':
    Could not find file 'mypath\mydb.accdb'.
    Not sure why?

    Thx
    w

  2. #2
    Join Date
    Mar 2009
    Posts
    5,442
    Provided Answers: 14
    Try:
    Code:
    strDBPath = "'mypath\mydb.accdb'"
    Then:
    Code:
    strSQL = "DELETE FROM tbl IN " & strDBPath
    Have a nice day!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •