ltworf13
10-09-2007, 10:31 AM
I've succesfully coded cms 9 & 11 however I'm having trouble with 13. the code runs but there's no data. has anyone else had this problem with CMS 13.set info Is Nothing ,See bode below:
Option Compare Database
Function Get_AvayaIDP_bra()
'DoCmd.OpenForm "waiting", acNormal
'creat function
getLoginLogoutIDP3 "rwynter", "ltworf14", "Barmpton_HS", "xx.xx.xx.xx bra", _
"113", [Form_MainSwitchboard].Calfrom.Value,
DoCmd.Close acForm, "Waiting"
'MsgBox "done"
End Function
Sub getLoginLogoutIDP3(UserName As String, Password As String, _
Location As String, strServerIP As String, skill As String, _
strStartdate As String, strEnddate As String, PathName As String)
Dim fs As New Scripting.FileSystemObject
Dim ext_txt As String
Dim info As Object
Dim REP As Object
Dim b As Boolean
Dim cvsapp As New ACSUP.cvsApplication
Dim status As Boolean
Dim log As CVSERR.cvsLog
Dim cvsConn As Object
Dim cvsapp13 As New ACSUP.cvsApplication
Dim daterange As String
Dim intNoOfDays As Integer
Dim Counter As Integer
Dim incDate As Date
Dim freenum As Integer
Dim freetmpnum As Integer
Dim filename As String
Dim linestring As String
Dim tmp As String
Dim begindate As Date
Dim dateinc As Date
Dim enddate As Date
Dim j As Integer
Dim Header As String
Dim outfile As String
ext_txt = ".csv"
Header = """Location""," & """Skill""," & """Date""," & """startint""," & _
"""dummy"","
Header = Header & """endint""," & """ServiceLevel""," & _
"""ACDCallsWflowOut""," & """AvgSpeedAns"","
Header = Header & """AvgAbanTime""," & """ACDCalls ""," & """AvgACDTime"","
Header = Header & """AvgACWTime""," & """AbanCalls""," & """MaxDelay""," & _
"""FlowIn"","
Header = Header & """FlowOut""," & """ExtnOutCalls""," & """BAHT"","
Header = Header & """OtherTime""," & """acdTime""," & """AuxTime""," & _
"""AvgPosStaff""," & """Occupancy"""
'Debug.Print Header
'GoTo skip:
'Debug.Print strStartDate, strEndDate
begindate = CDate(strStartdate)
enddate = CDate(strEnddate)
tmp = PathName + Location + "IDPtmp" + skill + ext_txt
outfile = PathName + Location + "IDP" + skill + ext_txt
ExportCVFile = PathName + Location + "ExportCVIDP" + skill + ext_txt
dateinc = begindate
j = 0
Open tmp For Output As #2
Print #2, Header
Do
strdate = CStr(dateinc)
' Create a new CMS Application, Connection, Server, & Report
Set cvsapp13 = CreateObject("ACSUP.cvsApplication")
Set cvsConn = CreateObject("ACSCN.cvsConnection")
Set cvssrv = CreateObject("ACSUPSRV.cvsServer")
Set REP = CreateObject("ACSREP.cvsReport")
' Assign values to the instance of the cvsServer created above
status = cvsapp13.CreateServer(UserName, Password, "", strServerIP, False, _
"ENU", cvssrv, cvsConn)
'status = cvsapp.CreateServer(UserName, Password, "", strServerIP, False, "ENU",cvssrv)
If status = False Then
MsgBox "Your Username or Password is Invalid on Server" & strServerIP & _
vbCrLf & "Connection Aborted"
Exit Sub
End If
'Debug.Print status
'filename = PathName + Location + Skill + "_" + CStr(j) + ext_txt
'Debug.Print intNoOfDays
On Error Resume Next
cvssrv.Reports.ACD = 1
Set info = cvssrv.Reports.Reports( _
"Historical\CMS custom\Skill Summ by Intvl")
If info Is Nothing Then
If cvssrv.Interactive Then
MsgBox "The report Historical\CMS custom\SK Sum by Int Rev was not" & _
" found on ACD 1.", vbCritical Or vbOKOnly, "CentreVu Supervisor"
Exit Sub
Else
Set log = CreateObject("CVSERR.cvsLog")
log.AutoLogWrite "The report Historical\CMS custom\SK Sum by Int Rev" & _
"was not found on ACD 1."
Set log = Nothing
Close #2
Exit Sub
End If
Else
b = cvssrv.Reports.CreateReport(info, REP)
If b Then
REP.Window.Top = 2835
REP.Window.Left = 420
REP.Window.Width = 14580
REP.Window.Height = 5910
REP.SetProperty "Split/Skill", skill
REP.SetProperty "Date", strdate
REP.SetProperty "Times", "00:00-23:30"
b = REP.ExportData(ExportCVFile, 44, 0, True, True, True)
REP.Quit
If Not cvssrv.Interactive Then cvssrv.ActiveTasks.Remove REP.TaskID
Set REP = Nothing
End If
End If
Set info = Nothing
cvsConn.Logout
cvsConn.Disconnect
Set log = Nothing
Set cvssrv = Nothing
Set cvsConn = Nothing
Set cvsapp = Nothing
'Set fs = CreateObject("Scripting.FileSystemObject")
Open ExportCVFile For Input As #1
freetmpnum = FreeFile()
For i = 1 To 9
Line Input #1, linestring
Next
While Not EOF(1)
Line Input #1, linestring
outline = Location & "," & skill & "," & strdate & "," & linestring
'Print #2, linestring
Print #2, outline
Wend
Close #1
j = j + 1
dateinc = dateinc + 1
Loop Until dateinc > enddate
Close #2
fs.CopyFile tmp, outfile, True
Set fs = Nothing
'skip:
End Sub
EDIT: Added VBA tags for readability also added line breaks ~ Tommy
Option Compare Database
Function Get_AvayaIDP_bra()
'DoCmd.OpenForm "waiting", acNormal
'creat function
getLoginLogoutIDP3 "rwynter", "ltworf14", "Barmpton_HS", "xx.xx.xx.xx bra", _
"113", [Form_MainSwitchboard].Calfrom.Value,
DoCmd.Close acForm, "Waiting"
'MsgBox "done"
End Function
Sub getLoginLogoutIDP3(UserName As String, Password As String, _
Location As String, strServerIP As String, skill As String, _
strStartdate As String, strEnddate As String, PathName As String)
Dim fs As New Scripting.FileSystemObject
Dim ext_txt As String
Dim info As Object
Dim REP As Object
Dim b As Boolean
Dim cvsapp As New ACSUP.cvsApplication
Dim status As Boolean
Dim log As CVSERR.cvsLog
Dim cvsConn As Object
Dim cvsapp13 As New ACSUP.cvsApplication
Dim daterange As String
Dim intNoOfDays As Integer
Dim Counter As Integer
Dim incDate As Date
Dim freenum As Integer
Dim freetmpnum As Integer
Dim filename As String
Dim linestring As String
Dim tmp As String
Dim begindate As Date
Dim dateinc As Date
Dim enddate As Date
Dim j As Integer
Dim Header As String
Dim outfile As String
ext_txt = ".csv"
Header = """Location""," & """Skill""," & """Date""," & """startint""," & _
"""dummy"","
Header = Header & """endint""," & """ServiceLevel""," & _
"""ACDCallsWflowOut""," & """AvgSpeedAns"","
Header = Header & """AvgAbanTime""," & """ACDCalls ""," & """AvgACDTime"","
Header = Header & """AvgACWTime""," & """AbanCalls""," & """MaxDelay""," & _
"""FlowIn"","
Header = Header & """FlowOut""," & """ExtnOutCalls""," & """BAHT"","
Header = Header & """OtherTime""," & """acdTime""," & """AuxTime""," & _
"""AvgPosStaff""," & """Occupancy"""
'Debug.Print Header
'GoTo skip:
'Debug.Print strStartDate, strEndDate
begindate = CDate(strStartdate)
enddate = CDate(strEnddate)
tmp = PathName + Location + "IDPtmp" + skill + ext_txt
outfile = PathName + Location + "IDP" + skill + ext_txt
ExportCVFile = PathName + Location + "ExportCVIDP" + skill + ext_txt
dateinc = begindate
j = 0
Open tmp For Output As #2
Print #2, Header
Do
strdate = CStr(dateinc)
' Create a new CMS Application, Connection, Server, & Report
Set cvsapp13 = CreateObject("ACSUP.cvsApplication")
Set cvsConn = CreateObject("ACSCN.cvsConnection")
Set cvssrv = CreateObject("ACSUPSRV.cvsServer")
Set REP = CreateObject("ACSREP.cvsReport")
' Assign values to the instance of the cvsServer created above
status = cvsapp13.CreateServer(UserName, Password, "", strServerIP, False, _
"ENU", cvssrv, cvsConn)
'status = cvsapp.CreateServer(UserName, Password, "", strServerIP, False, "ENU",cvssrv)
If status = False Then
MsgBox "Your Username or Password is Invalid on Server" & strServerIP & _
vbCrLf & "Connection Aborted"
Exit Sub
End If
'Debug.Print status
'filename = PathName + Location + Skill + "_" + CStr(j) + ext_txt
'Debug.Print intNoOfDays
On Error Resume Next
cvssrv.Reports.ACD = 1
Set info = cvssrv.Reports.Reports( _
"Historical\CMS custom\Skill Summ by Intvl")
If info Is Nothing Then
If cvssrv.Interactive Then
MsgBox "The report Historical\CMS custom\SK Sum by Int Rev was not" & _
" found on ACD 1.", vbCritical Or vbOKOnly, "CentreVu Supervisor"
Exit Sub
Else
Set log = CreateObject("CVSERR.cvsLog")
log.AutoLogWrite "The report Historical\CMS custom\SK Sum by Int Rev" & _
"was not found on ACD 1."
Set log = Nothing
Close #2
Exit Sub
End If
Else
b = cvssrv.Reports.CreateReport(info, REP)
If b Then
REP.Window.Top = 2835
REP.Window.Left = 420
REP.Window.Width = 14580
REP.Window.Height = 5910
REP.SetProperty "Split/Skill", skill
REP.SetProperty "Date", strdate
REP.SetProperty "Times", "00:00-23:30"
b = REP.ExportData(ExportCVFile, 44, 0, True, True, True)
REP.Quit
If Not cvssrv.Interactive Then cvssrv.ActiveTasks.Remove REP.TaskID
Set REP = Nothing
End If
End If
Set info = Nothing
cvsConn.Logout
cvsConn.Disconnect
Set log = Nothing
Set cvssrv = Nothing
Set cvsConn = Nothing
Set cvsapp = Nothing
'Set fs = CreateObject("Scripting.FileSystemObject")
Open ExportCVFile For Input As #1
freetmpnum = FreeFile()
For i = 1 To 9
Line Input #1, linestring
Next
While Not EOF(1)
Line Input #1, linestring
outline = Location & "," & skill & "," & strdate & "," & linestring
'Print #2, linestring
Print #2, outline
Wend
Close #1
j = j + 1
dateinc = dateinc + 1
Loop Until dateinc > enddate
Close #2
fs.CopyFile tmp, outfile, True
Set fs = Nothing
'skip:
End Sub
EDIT: Added VBA tags for readability also added line breaks ~ Tommy