Results 1 to 3 of 3
  1. #1
    Join Date
    Dec 2005
    Posts
    16

    connection to db

    Hi,


    I have a excel sheet that exports data in a db in the same folder that it is in. How do I set up the connection to the db without completely entering in the path.

    right now I have

    Set db = New ADODB.Connection
    db.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source = \Copy of TEST2.mdb;"

    I can't just set the path because I have to put this db on the newtwork, and different will map it with different drives to get access. But I don't remember the syntax for opening the db in the same folder.
    Thanks
    Emily

  2. #2
    Join Date
    Dec 2005
    Location
    Wilmington, DE - USA
    Posts
    275
    Emily,

    If this code is running from Excel, and if the MDB and the workbook are in the same folder, then:

    ThisWorkbook.Path & "\youraccessfile.mdb"

    should work.

  3. #3
    Join Date
    Dec 2005
    Posts
    16
    Thank you so much

    =) Emily

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

Similar Threads

  1. connection performance
    By DanM in forum Programming
    Replies: 0
    Last Post: 08-24-2008, 08:25 AM
  2. Replies: 0
    Last Post: 05-24-2006, 09:26 AM
  3. Connection to same DB
    By emilylu3 in forum Access
    Replies: 1
    Last Post: 12-30-2005, 09:59 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