This example illustrates use of the StillConnecting property when establishing a connection using the rdAsyncEnable option.
Dim rdoCn As New rdoConnection
Dim TimeExpected As Single
Dim Ts As Single, Tn As Single
TimeExpected = 15
With rdoCn
.Connect = "UID=;PWD=;Database=WorkDB;" _
& "Server=FarAway;Driver={SQL Server}" _
& "DSN='';"
.LoginTimeout = 45
.EstablishConnection rdDriverNoPrompt, _
True, rdAsyncEnable
Ts = Timer
ProgressBar1.Max = TimeExpected ' time to Open
While .StillConnecting
Tn = Int(Timer - Ts)
If Tn < TimeExpected Then
ProgressBar1 = Tn
Else
ProgressBar1.Max = ProgressBar1.Max + 10
TimeExpected = ProgressBar1.Max
End If
DoEvents
Wend
Status = "Duration:" & Int(Timer - Ts)
End With
rdoCn.Close
Exit Sub