I used a progress bar to inform the user of progress when checking that all tables were linked.
The number of tables was in "Thisdb.TableDefs.Count"
VarReturn is a variant. strMSG is a string, intI is an integer
-------------------------------------------------------
strMSG = "Checking " & Thisdb.TableDefs.Count & " tables for external linkages ..."
varReturn = SysCmd(acSysCmdInitMeter, strMSG, Thisdb.TableDefs.Count)
intI = 0
For Each ThisTblDef In Thisdb.TableDefs
intI = intI + 1
varReturn = SysCmd(acSysCmdUpdateMeter, intI)
. . .
. . . code which checks the tables
. . .
Next ' ThisTblDef
varReturn = SysCmd(acSysCmdClearStatus) ' clear bar
-------------------------------------------------------
The user sees a message "Checking nn tables for external linkages ..." and a progress bar.
Each time round the loop the bar gets bigger with the "varReturn = SysCmd(acSysCmdUpdateMeter, intI)" instruction.
At the end of the loop the progress bar and the message is cleared.
Make sure to include "varReturn = SysCmd(acSysCmdClearStatus)" in any error handler you use.
In each app I always have a main form called frmMain.
frmMain has lblStatus in navy backcolor, white forecolor.
I put the code below in a module named Status.
Then I have:
Public Sub Dummy()
Status.StatusBar "Please, wait. Importing..."
Call Import
Status.StatusBar "Please, wait. Calculating..."
Call Calc
Status.StatusBar "Please, wait. Exporting..."
Call Export
'Clear status
Status.StatusBar
End Sub
Public Function StatusBar(Optional Message As String = _
" Ready", _
Optional RedColor As Boolean = False) As String
Dim sSQL As String
StatusBar = Message
With Form_frmMain
.lblStatus.Caption = Space(3) & StatusBar
If RedColor = False Then
.lblStatus.BackColor = 7077888
Else
.lblStatus.BackColor = vbRed
End If
.Repaint
End With
End Function
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.