Wrox Programmer Forums
|
BOOK: Access 2003 VBA Programmer's Reference
This is the forum to discuss the Wrox book Access 2003 VBA Programmer's Reference by Patricia Cardoza, Teresa Hennig, Graham Seach, Armen Stein; ISBN: 9780764559037
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Access 2003 VBA Programmer's Reference section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 27th, 2006, 09:54 AM
Registered User
 
Join Date: Nov 2006
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default Linked Table Manager path in Visual Basic

I am new to Access and would appreciate if someone could help me with the following problem:

I have constructed a front-end database which accesses a number of tables in a separate back-end database. The link between front- and back-end is set up via the Linked Table Manager.

Is there a way in Visual Basic to find out to which value the string is set that specifies the path to the back-end database?

I would like to check that the tables have not moved before the first call to a table in the back-end is made, and deal with any errors that might occur.

Also, as the Seek operation is not allowed on linked tables I thought to circumvent this by opening these tables via an external link as suggested in Chapter 6 of Access 2003 VBA. I would like to use a variable for the pathname to the back-end database and pick up its value from Access rather than hard-code a path as the final location of the database is not yet known.

Thanks for any advice you can give,

Astrid Van Maanen
 
Old December 15th, 2006, 05:35 PM
Registered User
 
Join Date: Dec 2006
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I am also interested in finding the string that specifies the path to my back end database

Tommy

 
Old December 19th, 2006, 01:20 PM
Registered User
 
Join Date: Dec 2006
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Here's a solution:

'================================================= ==============
' The GetLinkedDBName() function requires the name of a
' linked Microsoft Access table, in quotation marks, as an
' argument. The function returns the full path of the originating
' database if successful, or returns 0 if unsuccessful.
'================================================= ==============

Function GetLinkedDBName (TableName As String)
   Dim db As DAO.Database, Ret
   On Error GoTo DBNameErr
   Set db = CurrentDb()
   Ret = db.TableDefs(TableName).Connect
   GetLinkedDBName = Right(Ret, Len(Ret) - (InStr _
      (1, Ret, "DATABASE=") + 8))
   Exit Function
DBNameErr:
   GetLinkedDBName = 0
End Function


 
Old December 29th, 2006, 10:34 AM
Registered User
 
Join Date: Nov 2006
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thank you very much for your reply; I have now tried it and it is exactly what I was looking for!

Astrid Van Maanen





Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I Delete a MS Word Table using visual basic B92125 Word VBA 2 November 21st, 2007 09:50 AM
visual data manager umeshtheone Pro VB 6 0 October 30th, 2007 05:21 AM
FTP in Visual Studio 2005 Pro (Visual Basic) shoopes VB How-To 1 June 29th, 2006 02:08 PM
Manager/Admin context path problem Vegtabill BOOK: Professional Apache Tomcat 1 October 24th, 2005 11:44 PM
changing root path in file manager codergirl BOOK: ASP.NET Website Programming Problem-Design-Solution 3 November 11th, 2004 04:21 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.