Solved

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

Posted on 2014-09-09
6
203 Views
Last Modified: 2014-09-09
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
0
Comment
Question by:SteveL13
  • 3
  • 3
6 Comments
 
LVL 57
ID: 40312370
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.
0
 

Author Comment

by:SteveL13
ID: 40312454
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.

??
0
 
LVL 57
ID: 40312518
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.
0
Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

 

Author Comment

by:SteveL13
ID: 40312602
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
0
 
LVL 57

Accepted Solution

by:
Jim Dettman (Microsoft MVP/ EE MVE) earned 500 total points
ID: 40312647
Well in that case, there is no way it's going to.  There's no hooks in the linked table manager that you can use to trigger a requery/refresh of data or trigger code.

 To do what you want, you'd have to do the relinking on your own and then push the data into the control again or do something that causes the OnCurrent event to fire again (like move off/on the record).

 Another method would be to remove the linked table manager from the ribbon, create a button (on the ribbon or in the form), and then do:

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

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

Last, another method would be to use a form timer and fire it every xx seconds.  In that event, push the data into the control.

The way you have it now though, it will refresh as soon as you move off the record.

Jim.
0
 

Author Closing Comment

by:SteveL13
ID: 40312787
Thanks Jim!  I used the form timer method.  Works perfectly.
0

Featured Post

Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction When developing Access applications, often we need to know whether an object exists.  This article presents a quick and reliable routine to determine if an object exists without that object being opened. If you wanted to inspect/ite…
QuickBooks® has a great invoice interface that we were happy with for a while but that changed in 2001 through no fault of Intuit®. Our industry's unit names are dictated by RUS: the Rural Utilities Services division of USDA. Contracts contain un…
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

820 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question