Question

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.

' 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:

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 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)

cmsConnection.lTimeOutSecs = 60
cmsConnection.bTimeOutEnable = False
Was it helpful?

Solution

In my organization we have had mostly frustration hacking the undocumented VBA API to avaya CMS supervisor application. I would suggest instead using a direct ODBC connection to the Avaya server. Avaya provides plenty of documentation about how to ODBC connect to its servers. If you need help finding the avaya documentation specific to your installation please reply with the version you are working with.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top