0

当我运行代码以从 CMS 报告中检索数据时,如果我单步执行代码,则代码可以工作,但如果我正常运行,它(最终)会失败,并且 MS Access 停止响应。

' 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

用于检查剪贴板的子程序,并在我尝试将数据放入剪贴板之前将其清空:

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

我对对象使用后期绑定,并且安装了 Avaya CMS 16.2。
我尝试设置超时,但没有成功(任一行或两者都无法解决问题)

cmsConnection.lTimeOutSecs = 60
cmsConnection.bTimeOutEnable = False
4

1 回答 1

1

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.

于 2013-03-26T13:09:55.670 回答