Solved

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

Posted on 2014-09-09
6
202 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
Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

 

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

Backup Your Microsoft Windows Server®

Backup 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.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Search for text in a .txt file 14 44
Trying to open FORM in specific record !! 6 44
Calculation in Access 5 26
Problem copying record details to a new record 5 8
I see at least one EE question a week that pertains to using temporary tables in MS Access.  But surprisingly, I was unable to find a single article devoted solely to this topic. I don’t intend to describe all of the uses of temporary tables in t…
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…

770 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