When I run my code to retrieve data from a CMS report, if I single step through the code, the code works, but if I run it normally, it (eventually) fails, and MS Access stops responding.
the subroutines used for checking clipboard, and emptying it before I try to get the data into the clipboard:
I use late binding for the objects, and I have Avaya CMS 16.2 installed.
I have tried setting the timeouts, with no success (either line, or both, fails to solve the issue)
Code:
' Sets parameters for report
cmsReport.SetProperty reportPrompt(1, 1), reportPrompt(1, 2)
cmsReport.SetProperty reportPrompt(2, 1), reportPrompt(2, 2)
cmsReport.SetProperty reportPrompt(3, 1), reportPrompt(3, 2)
' Runs report and extracts results
EmptyClipboard
b = cmsReport.ExportData("", 44, 0, True, True, True)
Do While ClipboardEmpty
' for some reason, avaya doesn't always copy to clipboard, so keep repeating it until it gives up the data!
b = cmsReport.ExportData("", 44, 0, True, True, True)
Loop
the subroutines used for checking clipboard, and emptying it before I try to get the data into the clipboard:
Code:
Private Declare Function apiOpenClipboard Lib "user32" Alias "OpenClipboard" (ByVal hWnd As Long) As Long
Private Declare Function apiEmptyClipboard Lib "user32" Alias "EmptyClipboard" () As Long
Private Declare Function apiCloseClipboard Lib "user32" Alias "CloseClipboard" () As Long
Private Declare Function CountClipboardFormats Lib "user32" () As Long
Sub EmptyClipboard()
If apiOpenClipboard(0&) <> 0 Then
Call apiEmptyClipboard
Call apiCloseClipboard
End If
End Sub
Function ClipboardEmpty() As Boolean
ClipboardEmpty = (CountClipboardFormats() = 0)
End Function
I have tried setting the timeouts, with no success (either line, or both, fails to solve the issue)
Code:
cmsConnection.lTimeOutSecs = 60
cmsConnection.bTimeOutEnable = False