Link to home
Start Free TrialLog in
Avatar of SteveL13
SteveL13Flag for United States of America

asked on

How display name of back-end file on main form of front end file

I want to display the name of back-end file on main form of front end file for a split database.    Can this be done?

--Steve
Avatar of Jim Dettman (EE MVE)
Jim Dettman (EE MVE)
Flag of United States of America image

Yes.

  CurrentDB().TableDefs("<table name>").Connect

Will give you the connection string for a table.  Pick any table that is in that BE, get the connect string, then look for DATABASE=

What's after that is the path to the BE database.

Jim.
Avatar of SteveL13

ASKER

Thanks.  I have the file path and name displaying on the Main Form of the front-end.  But if I manually re-link the tables to a different B/E file the name doesn't refresh itself until I close and re-open the database.

??
How are you manually re-linking?

 Depending on how, it's either that you'll need to refresh the tableDefs collection or the control that is displaying the value.

  But you certainly don't need to close and re-open the app.

Jim.
I have this code in the oncurrent event of the form.

Dim MyConnectString As String
Dim MyFullPath As String

    MyConnectString = CurrentDb().TableDefs("Member Table").Connect
    MyFullPath = Right(MyConnectString, Len(MyConnectString) - Len("Database;"))

    Me.txtCurrentBEfile = "Current B/E File: " & MyFullPath

Open in new window

But when I:

External Data > Linked Table Manager > to link to a different backend, the field, Me.txtCurrentBEfile , is not "refreshed" and still shows the last B/E file
ASKER CERTIFIED SOLUTION
Avatar of Jim Dettman (EE MVE)
Jim Dettman (EE MVE)
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks Jim!  I used the form timer method.  Works perfectly.