D
Dean
I am getting the Table Description property from another database on my
local drive using the following code. When I am setting the tdfTemp object
variable it takes several seconds in Access 2002. In Access 97 is was
instantaneous. Any ideas why it is slower or what I can do to make it go
faster?
Function GetTblDescription(strDatabase As String, strTable As String) As
String
' Comments : Returns the description of the named table
' (correctly handles attached tables)
' Parameters: strDatabase - path and name of database to look in or ""
(blank string) for the current database
' strTable - name of table to look in
' Returns : string description or "<none>"
'
Dim dbsTemp As DAO.Database
Dim tdfTemp As DAO.TableDef
Dim strTemp As String
On Error GoTo PROC_ERR
If strDatabase = "" Then
'Set dbsTemp = CurrentDb()
Set dbsTemp = DBEngine.Workspaces(0).Databases(0)
Else
'Set dbsTemp = DBEngine.Workspaces(0).OpenDatabase(strDatabase,
False, False, "MS Access;PWD=123;") ' For Write
Set dbsTemp = OpenDatabase(strDatabase)
End If
Set tdfTemp = dbsTemp.TableDefs(strTable)
On Error Resume Next
strTemp = tdfTemp.Properties("Description")
If Err <> 0 Then
strTemp = "<none>"
End If
On Error GoTo PROC_ERR
GetTblDescription = strTemp
dbsTemp.Close
Set tdfTemp = Nothing
PROC_EXIT:
Exit Function
PROC_ERR:
GetTblDescription = ""
Resume PROC_EXIT
End Function
local drive using the following code. When I am setting the tdfTemp object
variable it takes several seconds in Access 2002. In Access 97 is was
instantaneous. Any ideas why it is slower or what I can do to make it go
faster?
Function GetTblDescription(strDatabase As String, strTable As String) As
String
' Comments : Returns the description of the named table
' (correctly handles attached tables)
' Parameters: strDatabase - path and name of database to look in or ""
(blank string) for the current database
' strTable - name of table to look in
' Returns : string description or "<none>"
'
Dim dbsTemp As DAO.Database
Dim tdfTemp As DAO.TableDef
Dim strTemp As String
On Error GoTo PROC_ERR
If strDatabase = "" Then
'Set dbsTemp = CurrentDb()
Set dbsTemp = DBEngine.Workspaces(0).Databases(0)
Else
'Set dbsTemp = DBEngine.Workspaces(0).OpenDatabase(strDatabase,
False, False, "MS Access;PWD=123;") ' For Write
Set dbsTemp = OpenDatabase(strDatabase)
End If
Set tdfTemp = dbsTemp.TableDefs(strTable)
On Error Resume Next
strTemp = tdfTemp.Properties("Description")
If Err <> 0 Then
strTemp = "<none>"
End If
On Error GoTo PROC_ERR
GetTblDescription = strTemp
dbsTemp.Close
Set tdfTemp = Nothing
PROC_EXIT:
Exit Function
PROC_ERR:
GetTblDescription = ""
Resume PROC_EXIT
End Function