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

    Connection to same DB

    I know this is awful, making a connection to a database that you are in already, but just like ThisWorkBook.Path gets you the current excel path, how can you get the path for the database you are in.

    My Code:
    db.Open "provider=microsoft.jet.oledb.4.0;data source=" & "WHAT GOES IN HERE" & "Copy of TEST2.mdb;"
    Thanks


    Emily

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

    Re: Connection to same DB

    Quote Originally Posted by emilylu3
    I know this is awful, making a connection to a database that you are in already, but just like ThisWorkBook.Path gets you the current excel path, how can you get the path for the database you are in.
    Try something like CurrentProject.Path.

    BTW, in Excel VBA, ThisWorkbook returns a reference to the workbook that has the VBA Project in which the currently-executing code lives, which is not necessarily the same thing as the currently-active workbook (which is returned by ActiveWorkbook). Sometimes they are one and the same, but not always.

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 db
    By emilylu3 in forum Access
    Replies: 2
    Last Post: 12-29-2005, 01:06 PM

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