I am not be able to test it but, please, give a try to this:
Code:
Const DELAY As Single = 0.1
Dim intCnt As Integer
Dim sngTimer As Single
Dim cProg As clsLblProgress
Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim SqlStr As String
Set db = CurrentDb
Set rs = db.OpenRecordset("T_ServerTbls")
'Check for returned records.
If Not (rs.BOF And rs.EOF) Then
'Get the actualy record count.
rs.MoveLast
rs.MoveFirst
'Always, create an instance of an object
'only if there is a reason to be.
Set cProg = New clsLblProgress
With cProg
.Initialize LblBack, LblFront, LblCaption
.Max = rs.RecordCount
End With
'Code to connect server tbls
Do While Not rs.EOF
'Delay...
sngTimer = Timer
Do While Timer < sngTimer + DELAY
DoEvents
Loop
'Connect the table.
If AttachDSNLessTable(rs!stLocalTableName, rs!stRemoteTableName, "(Local)", "HRINAT", "", "") Then
cProg.Increment 'Only for connected tables. Otherwise, move this line under the next line.
End If
rs.MoveNext 'press Ctrl+G to see debuG window beneath
Loop
'Clean up.
rs.Close
'Release the instance of the clsLblProgress.
Set cProg = Nothing
End If
'Release the recordset instance.
Set rs = Nothing
'Release the Database instance.
Set db = Nothing
'Open your main form.
DoCmd.OpenForm "F_MainBoard"
Let me know if it works properly.
Regards,
John