We recently got upgraded from Windows Xp to Windows 7. The code segment below is where I'm having issues.
Private Sub RptByCSR()
On Error GoTo ErrorHandler
Dim strDateParam As String
' Change mouse pointer to an hourglass
Screen.MousePointer = vbHourglass
If gboolAuditOn Then
Call AuditActivity("RptByCSR", gstrLan_ID)
End If
objCrystalReport1.Reset
objCrystalReport1.WindowState = crptMaximized
objCrystalReport1.DiscardSavedData = True
objCrystalReport1.WindowTitle = "Assist Line CA History"
objCrystalReport1.ReportFileName = App.Path & "\Reports\CSRHistory.rpt"
objCrystalReport1.LogOnServer "p2ssql.dll", gCurrentConnIPAddress, "AssistLine", "aladmin", G_APP_PW
objCrystalReport1.StoredProcParam(0) = Trim(CStr(lstItem.SelectedItem))
' Crystal date formats should appear like this:
'objCrystalReport1.StoredProcParam(1) = "2006-10-01 00:00:00.000"
strDateParam = Format(dtpStartDate, "yyyy-mm-dd") & " 00:00:00.000"
objCrystalReport1.StoredProcParam(1) = strDateParam
strDateParam = Format(dtpStartDate, "mm/dd/yyyy")
objCrystalReport1.Formulas(1) = "FromD='" & strDateParam & "'"
strDateParam = Format(dtpEndDate, "yyyy-mm-dd hh:mm:ss") & ".000"
objCrystalReport1.StoredProcParam(2) = strDateParam
strDateParam = Format(dtpEndDate, "mm/dd/yyyy")
objCrystalReport1.Formulas(2) = "ToD='" & strDateParam & "'"
objCrystalReport1.Connect = gConnString
objCrystalReport1.WindowShowSearchBtn = True
objCrystalReport1.WindowShowGroupTree = True
objCrystalReport1.RetrieveDataFiles
objCrystalReport1.Action = 1
CleanUpAndExit:
Screen.MousePointer = vbDefault
Exit Sub
ErrorHandler:
If Err <> 20536 Then
ErrorTrap Err, Me.Name, "RptByCSR", "", True
Else
Resume Next
End If
Resume CleanUpAndExit
End Sub
The issue here is that when this subroutine runs, the report does not show but in my error log table I have the error number as 20599 and the error description as "Cannot Open SQL Server"
Please your help will be appreciated as I am so frustrated by this issue and time is ticking.
Private Sub RptByCSR()
On Error GoTo ErrorHandler
Dim strDateParam As String
' Change mouse pointer to an hourglass
Screen.MousePointer = vbHourglass
If gboolAuditOn Then
Call AuditActivity("RptByCSR", gstrLan_ID)
End If
objCrystalReport1.Reset
objCrystalReport1.WindowState = crptMaximized
objCrystalReport1.DiscardSavedData = True
objCrystalReport1.WindowTitle = "Assist Line CA History"
objCrystalReport1.ReportFileName = App.Path & "\Reports\CSRHistory.rpt"
objCrystalReport1.LogOnServer "p2ssql.dll", gCurrentConnIPAddress, "AssistLine", "aladmin", G_APP_PW
objCrystalReport1.StoredProcParam(0) = Trim(CStr(lstItem.SelectedItem))
' Crystal date formats should appear like this:
'objCrystalReport1.StoredProcParam(1) = "2006-10-01 00:00:00.000"
strDateParam = Format(dtpStartDate, "yyyy-mm-dd") & " 00:00:00.000"
objCrystalReport1.StoredProcParam(1) = strDateParam
strDateParam = Format(dtpStartDate, "mm/dd/yyyy")
objCrystalReport1.Formulas(1) = "FromD='" & strDateParam & "'"
strDateParam = Format(dtpEndDate, "yyyy-mm-dd hh:mm:ss") & ".000"
objCrystalReport1.StoredProcParam(2) = strDateParam
strDateParam = Format(dtpEndDate, "mm/dd/yyyy")
objCrystalReport1.Formulas(2) = "ToD='" & strDateParam & "'"
objCrystalReport1.Connect = gConnString
objCrystalReport1.WindowShowSearchBtn = True
objCrystalReport1.WindowShowGroupTree = True
objCrystalReport1.RetrieveDataFiles
objCrystalReport1.Action = 1
CleanUpAndExit:
Screen.MousePointer = vbDefault
Exit Sub
ErrorHandler:
If Err <> 20536 Then
ErrorTrap Err, Me.Name, "RptByCSR", "", True
Else
Resume Next
End If
Resume CleanUpAndExit
End Sub
The issue here is that when this subroutine runs, the report does not show but in my error log table I have the error number as 20599 and the error description as "Cannot Open SQL Server"
Please your help will be appreciated as I am so frustrated by this issue and time is ticking.