|
2#
楼主 |
发表于 2003-4-8 17:55:00
|
只看该作者
Function ap_LogOutCheck(strBackEndPath) As Integer
On Error Resume Next
ap_LogOutCheck = Dir(strBackEndPath & "\LogOut.FLG", vbHidden) = "LogOut.FLG"
End Function
Function ap_FormIsOpen(strFormName As String) As Integer
Dim frmCurrent As Form
For Each frmCurrent In Forms
If frmCurrent.Name = strFormName Then
ap_FormIsOpen = True
Exit Function
End If
Next frmCurrent
End Function
Function ap_GetDatabaseProp(dbDatabase As Database, strPropertyName As String) As Variant
ap_GetDatabaseProp = dbDatabase.Containers!Databases _
.Documents("UserDefined").Properties(strPropertyName).Value
End Function
Sub ap_SetDatabaseProp(dbDatabase As Database, strPropertyName As String, varValue As Variant)
dbDatabase.Containers!Databases.Documents("UserDefined").Properties(strPropertyName).Value = varValue
End Sub
Public Sub ap_LinkTables(dbLocal, dynSharedTables, strDataMDB As String)
Dim tdfCurrent As TableDef
Dim flgAddTable As Boolean
Dim intTotalTbls As Integer
Dim intCurrTbl As Integer
On Error GoTo Err_LinkTables
'-- Get the total number of linked tables, then display the progress meter.
dynSharedTables.MoveLast
intTotalTbls = dynSharedTables.RecordCount
dynSharedTables.MoveFirst
SysCmd acSysCmdInitMeter, "Linking Tables....", intTotalTbls
intCurrTbl = 1
Do Until dynSharedTables.EOF
'-- Update the progress meter
SysCmd acSysCmdUpdateMeter, intCurrTbl
'-- Attempt to open the current link
On Error Resume Next
Set tdfCurrent = dbLocal.TableDefs(dynSharedTables!TableName)
flgAddTable = Err.Number
On Error GoTo Err_LinkTables
'-- If there was an error, create the link from scratch,
'-- otherwise, just update the connect string
If flgAddTable Then
Set tdfCurrent = dbLocal.CreateTableDef(dynSharedTables!TableName)
tdfCurrent.SourceTableName = dynSharedTables!TableName
tdfCurrent.Connect = ";DATABASE=" & strDataMDB
CurrentDb.TableDefs.Append tdfCurrent
Else
tdfCurrent.Connect = ";DATABASE=" & strDataMDB
tdfCurrent.RefreshLink
End If
dynSharedTables.MoveNext
intCurrTbl = intCurrTbl + 1
Loop
Exit_LinkTables:
SysCmd acSysCmdRemoveMeter
Exit Sub
Err_LinkTables:
Resume Exit_LinkTables
End Sub |
|