Attribute VB_Name = "modCrystal" Option Explicit Public gobjReport As CRAXDRT.Report Public gstrHospitalName As String Public gstrHospitalAddress1 As String Public gstrHospitalAddress2 As String 'Public pclsUser As Object 'MEDSYS_User.clsCurrentUser 'Public Sub InitializeReportVariables(ByVal pstrHospitalName As String, _ ' ByVal pstrHospitalAddress1 As String, _ ' ByVal pstrHospitalAddress2 As String, _ ' ByVal ppclsuser As Object) ' gstrHospitalName = pstrHospitalName ' gstrHospitalAddress1 = pstrHospitalAddress1 ' gstrHospitalAddress2 = pstrHospitalAddress2 ' ' Set pclsuser = ppclsuser 'End Sub Public Sub OpenMainReport(ByVal strReportFileName As String, ParamArray strParameters()) Dim crxParameterField As CRAXDRT.ParameterFieldDefinition Dim intCtr As Integer Dim intTotalParam As Integer Dim crxtable As CRAXDRT.DatabaseTable Dim crxApplication As New CRAXDRT.Application intTotalParam = UBound(strParameters) Set gobjReport = crxApplication.OpenReport(strReportFileName, 1) gobjReport.ReportTitle = gstrHospitalName For Each crxtable In gobjReport.Database.Tables crxtable.Location = "Patient_Data" + Mid(crxtable.Location, InStr(1, crxtable.Location, ".")) crxtable.SetLogOnInfo pclsUser.ServerName, "Patient_Data", pclsUser.UserID, pclsUser.ServerPassword Next If intTotalParam >= 0 Then For Each crxParameterField In gobjReport.ParameterFields If intTotalParam >= intCtr Then crxParameterField.AddCurrentValue strParameters(intCtr) Else Exit For End If intCtr = intCtr + 1 Next End If Set crxParameterField = Nothing Set crxtable = Nothing Set crxApplication = Nothing End Sub Public Sub OpenSubReport(ByVal strSubReport As String, ParamArray strParameters()) Dim crxParameterField As CRAXDRT.ParameterFieldDefinition Dim intCtr As Integer Dim intTotalParam As Integer Dim crxtable As CRAXDRT.DatabaseTable Dim crxSubreport As CRAXDRT.Report intTotalParam = UBound(strParameters) Set crxSubreport = gobjReport.OpenSubReport(strSubReport) For Each crxtable In crxSubreport.Database.Tables crxtable.Location = "Patient_Data" + Mid(crxtable.Location, InStr(1, crxtable.Location, ".")) crxtable.SetLogOnInfo pclsUser.ServerName, "Patient_Data", pclsUser.UserID, pclsUser.ServerPassword Next If intTotalParam >= 0 Then For Each crxParameterField In crxSubreport.ParameterFields If intTotalParam >= intCtr Then crxParameterField.AddCurrentValue strParameters(intCtr) Else Exit For End If intCtr = intCtr + 1 Next End If Set crxParameterField = Nothing Set crxtable = Nothing Set crxSubreport = Nothing End Sub Public Sub ShowReportViewer(Optional blnShowGroupTree As Boolean = False, _ Optional strCaption As String = "", _ Optional blnDirectToPrinter As Boolean = False, _ Optional blnShowModal As Boolean = False) Dim objfrmReportViewerShared As New frmReportViewerShared With objfrmReportViewerShared .ShowGroupTree = blnShowGroupTree .Caption = strCaption .DirectPrint = blnDirectToPrinter .FileCaption = strCaption If blnShowModal Then .Show vbModal Else .Show End If End With End Sub