this is the form codes:
Option Compare Database
Private Sub Form_Close()
DoCmd.Hourglass False
DoCmd.OpenForm "frmMainMenu"
End Sub
Private Sub Form_Load()
DoCmd.Maximize
Dim varTime As Variant, strLegend As String
varTime = Time()
If varTime > "00:00:01" And varTime < "12:00" Then strLegend = "Welcome! Good Morning..."
If varTime >= "12:00" And varTime < "18:00" Then strLegend = "Welcome! Good Afternoon..."
If varTime >= "18:00" And varTime < "23:59" Then strLegend = "Welcome! Good Evening..."
Me.lblGreeting.Caption = strLegend
End Sub
Private Sub Form_Timer()
On Error Resume Next
DoCmd.Hourglass True
Me.TimerInterval = 0
Me.Repaint
DoEvents
ProcessTables
DoCmd.Hourglass False
DoCmd.Close acForm, "frmIntro", acSaveNo
End Sub
and this is the module linked to the form:
Option Compare Database
Option Explicit
Public fCancel As Boolean
Sub ProcessTables()
On Error GoTo Err_Handler
Dim lngCurrentPosition As Long
Dim intTable As Integer
Dim strMsg As String
DoCmd.Hourglass True
lngCurrentPosition = 0
For lngCurrentPosition = 0 To 10000
intTable = lngCurrentPosition \ 100
strMsg = "Processing table #" & intTable
UpdateProgressMeter strMsg, lngCurrentPosition
DoEvents
lngCurrentPosition = lngCurrentPosition + 1
If fCancel Then Exit For
Next
Exit_Here:
DoCmd.Hourglass False
Exit Sub
Err_Handler:
MsgBox Err.Description
fCancel = False
Resume Exit_Here
End Sub
Private Sub UpdateProgressMeter(ByVal strMsg As String, ByVal lngPosition As Long)
On Error Resume Next
Dim intPercent As Integer
Const conTotal As Integer = 10000
intPercent = (lngPosition / conTotal) * 100
With Forms!frmIntro
!lblBlue.Width = intPercent / 100 * !lblTransparent.Width
!lblMessage.Caption = "" & intPercent & "%"
.Repaint
End With
DoEvents
End Sub