VBA-tools / VBA-Web

VBA-Web: Connect VBA, Excel, Access, and Office for Windows and Mac to web services and the web
http://vba-tools.github.io/VBA-Web/
MIT License
2.01k stars 494 forks source link

Application.OnTime - Access #336

Open certifirm opened 6 years ago

certifirm commented 6 years ago
' Start timeout timer
Private Sub web_StartTimeoutTimer()
    Dim web_TimeoutS As Long

    If WebHelpers.AsyncRequests Is Nothing Then: Set WebHelpers.AsyncRequests = New Dictionary

    ' Round ms to seconds with minimum of 1 second if ms > 0
    web_TimeoutS = Round(Me.Client.TimeoutMs / 1000, 0)
    If Me.Client.TimeoutMs > 0 And web_TimeoutS = 0 Then
        web_TimeoutS = 1
    End If

    WebHelpers.AsyncRequests.Add Me.Request.Id, Me
    Application.OnTime Now + TimeValue("00:00:" & web_TimeoutS), "'WebHelpers.OnTimeoutTimerExpired """ & Me.Request.Id & """'"
End Sub

Application.OnTime only exists in Excel.

certifirm commented 6 years ago

Related to:

https://github.com/VBA-tools/VBA-Web/issues/283

Anyone has implemeted it with timers or another form?

mauriciojxs commented 6 years ago

Had to comment the line that starts with Application.OnTime... Worked anyway but I supose I may face some issues if a server won't respond.