Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Backend Path 1

Status
Not open for further replies.

emergencyplan

Technical User
Aug 19, 2003
34
GB
Hello,

I wish to have a very basic form with one command button and one text box, when the command button is selected by the user the path (file location) of the database back-end is displayed. Lets assume I have one table called "MyTable".

Is there a easy way of doing this, I have looked at the "Connect" property but I am not having any success.

Many thanks,

Laurence
 
Hi Laurence,

The following function will extract and return the full path of a linked jet database file from it's connection string:

-----
Code:
Function GetLinkedMDBPath(ConnectString As String) As String

    Dim intStart As Integer, intLength As Integer
    
    intStart = InStr(1, ConnectString, "DATABASE=") + 9
    intLength = (InStrRev(ConnectString, ".mdb") + 4) - intStart
    GetLinkedMDBPath = Mid(ConnectString, intStart, intLength)

End Function
-----

Call the function using the following sample syntax:

strFilePath = GetLinkedMDBPath(CurrentDb.TableDefs("MyTable").Connect)

Hope this helps.

Glen Appleton

VB.Net student.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top