ACC1x: How to Find Attached Table's Database NameID: Q109725
|
This article describes how to use the FindFirst method on a dynaset of the MSysObjects table to find the path and filename of the database that contains an attached table.
The following example demonstrates how to use the FindFirst method to
find the path and filename of the database that contains an attached
table:
'********************
' MODULE DECLARATIONS
'********************
Option Explicit
Function AttachedDBName (TableName As String)
Dim DB As Database
Dim DS As Dynaset
Set DB = CurrentDB()
Set DS = DB.CreateDynaset("MSysObjects")
DS.FindFirst "[name] = '" & TableName & "'"
If Not DS.NoMatch Then
AttachedDBName = DS![database]
Else
AttachedDBName = ""
End If
End Function
Microsoft Access "User's Guide," versions 1.0 and 1.1, Chapter 4, "Importing, Exporting, and Attaching," pages 60-72
Keywords : kbprg PgmObj
Version : 1.0 1.1
Platform : WINDOWS
Issue type : kbhowto
Last Reviewed: April 2, 1999