currently i am using this code to ReLink Tables and flash the status bar so the user is aware there is activity BUT most do not see it and get impatient. So I have a form with a progress bar type solution. having some difficulty combining the two. there are 19 linked tables that i can pull the qty from using this code DCount("*", "MSysObjects", "Type = 4")
Code:
Public Function RelinkTables() '(environment As Integer) On Error Resume Next
Dim tblDef As DAO.TableDef
Dim LinkedTableCount As Integer
Form_frm_Progress.TimerInterval = 250
LinkedTableCount = DCount("*", "MSysObjects", "Type = 4")
For Each tblDef In CurrentDb.TableDefs
If tblDef.Connect <> "" Then
tblDef.Connect = DLookup("ODBCPath", "tbl_SystemInfo", "SystemInfoID= 1")
'tblDef.Connect = GetConnectionString(environment)
Status ("Linking Table......")
tblDef.RefreshLink
End If
Status ("")
Next
End Function
Code:
Sub Status(pstrStatus As String)
Dim lvarStatus As Variant
If pstrStatus = "" Then
lvarStatus = SysCmd(acSysCmdClearStatus)
Else
lvarStatus = SysCmd(acSysCmdSetStatus, pstrStatus)
End If
End Sub
here is the form i am using
Code:
Private Sub Command2_Click()Dim LinkedTableCount As Integer
LinkedTableCount = DCount("*", "MSysObjects", "Type = 4")
Me.TimerInterval = 250
End Sub
Private Sub Form_Timer()
Me.txtCount = Me.txtCount + 1
Me.Box3.Width = Me.txtCount * 100
If Me.txtCount = 100 Then
Me.TimerInterval = 0
End If
End Sub
cant figure out how to combine them. after each table gets linked it updates the progress bar.
Thanks