Solved

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

Posted on 2014-09-09
6
197 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

Expert Comment

by:Jim Dettman (Microsoft MVP/ EE MVE)
Comment Utility
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
Comment Utility
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

Expert Comment

by:Jim Dettman (Microsoft MVP/ EE MVE)
Comment Utility
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
6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

 

Author Comment

by:SteveL13
Comment Utility
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
Comment Utility
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
Comment Utility
Thanks Jim!  I used the form timer method.  Works perfectly.
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

When you are entering numbers in a speadsheet, and don't remember what 6×7 is, you just type “=6*7" instead. It works in every cell! This is not so in Access. To enter the elusive 42 in a text box, you have to find a calculator, and then copy the re…
Today's users almost expect this to happen in all search boxes. After all, if their favourite search engine juggles with tens of thousand keywords while they type, and suggests matching phrases on the fly, why shouldn't they expect the same from you…
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
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…

772 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now