Attribute VB_Name = "modReport" 'Public Sub OpenMainReport(ByVal strReportFileName As String, ParamArray strParameters()) 'On Error GoTo Errmessage: ' ' Dim crxParameterField As CRAXDRT.ParameterFieldDefinition ' Dim intCtr As Integer ' Dim intTotalParam As Integer ' Dim crxTable As CRAXDRT.DatabaseTable ' Dim crxApplication As New CRAXDRT.Application ' Dim strDatabaseName As String ' blnShowReport = True ' strDatabaseName = gDatabase ' Dim strClientName As String ' ' strSql = "select clientname from patient_data..tbhospitalinfo" ' With conFA.Execute(strSql) ' If .RecordCount > 0 Then ' strClientName = (!clientname & "") ' End If ' End With ' ' ' Dim IntCountA As Integer ' Dim IntCountB As Integer ' Dim filename As String ' ' IntCountA = Len(App.path & "\Reports\") ' IntCountB = Len(strReportFileName) - IntCountA ' ' filename = Right(strReportFileName, IntCountB) ' ' If File_Exists(App.path & "\Reports\customised\" & filename) Then ' strReportFileName = App.path & "\Reports\customised\" & filename ' ElseIf File_Exists(App.path & "\Reports\" & filename) Then ' strReportFileName = App.path & "\Reports\" & filename ' Else ' MsgBox filename & " not exists. Please contact IT Department.", vbCritical + vbOKOnly, gblMessageBoxTitle ' blnShowReport = False ' Exit Sub ' End If ' ' ' ' ' ' intCtr = 0 ' intTotalParam = UBound(strParameters) ' Set Report = crxApplication.OpenReport(strReportFileName, 1) ' Report.ReportTitle = gblTitleReport ' For Each crxTable In Report.Database.Tables ' crxTable.Location = strDatabaseName + Mid(crxTable.Location, InStr(1, crxTable.Location, ".")) ' crxTable.SetLogOnInfo MedsysUser.ServerName, strDatabaseName, MedsysUser.userID, MedsysUser.serverpassword ' Next ' ' If intTotalParam >= 0 Then ' For Each crxParameterField In Report.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 ' Exit Sub 'Errmessage: 'MsgBox "Error loading Sub OpenMainReport(). " & strRptFileName & " -- " & Err.description & ". Please contact EDP/IRM for assistance.", vbCritical, App.Title 'blnShowReport = False 'Exit Sub '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 crxApplication As New CRAXDRT.Application ' Dim strDatabaseName As String ' ' strDatabaseName = gDatabase ' ' intTotalParam = UBound(strParameters) ' Set crxSubreport = Report.OpenSubReport(strSubReport) ' crxSubreport.ReportTitle = sHospitalName ' For Each crxTable In crxSubreport.Database.Tables ' crxTable.Location = strDatabaseName + Mid(crxTable.Location, InStr(1, crxTable.Location, ".")) ' crxTable.SetLogOnInfo MedsysUser.ServerName, strDatabaseName, MedsysUser.userID, MedsysUser.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) ' On Error GoTo errTrap: ' Dim frmRView As New frmReportViewer ' With frmRView ' .ShowGroupTree = blnShowGroupTree ' .Caption = strCaption ' .DirectPrint = blnDirectToPrinter ' .Show vbModal ' End With ' Exit Sub 'errTrap: 'MsgBox Err.description, vbCritical, "Sub.Showreportviewer" 'End Sub ' 'Public Function SetLogOnInfo(crxTable As CRAXDRT.DatabaseTable, strDatabaseName As String) ' With MedsysUser ' crxTable.Location = strDatabaseName + Mid(crxTable.Location, InStr(1, crxTable.Location, ".")) ' crxTable.SetLogOnInfo .ServerName, strDatabaseName, .userID, .serverpassword ' End With 'End Function 'Public Function FileExists(sFullPath As String) As Boolean ' Dim oFile As New Scripting.FileSystemObject ' FileExists = oFile.FileExists(sFullPath) 'End Function 'Public Sub ExportXLS(Optional strfilename As String = "") ' ' Dim strMyDocuments As String ' Dim strDiskName As String ' ' ' Dim WshShell As Object ' Set WshShell = CreateObject("WScript.Shell") ' strMyDocuments = WshShell.SpecialFolders("MyDocuments") ' ' ' strMyDocuments = Environ$("USERPROFILE") ' ' If Len(strMyDocuments) = 0 Then ' ' strMyDocuments = "C:\My Documents" ' ' Else ' ' strMyDocuments = fs.BuildPath(strMyDocuments, "My Documents") ' ' End If ' ' strDiskName = fs.BuildPath(strMyDocuments, fs.GetBaseName(strfilename) & "." & Format$(Now, "yyyy.MM.dd.hh.mm.ss") & ".xls") ' If MsgBox("Do you wish to export the report?", vbYesNo, "Export Report to Disk") = vbYes Then ' Report.ExportOptions.DiskFileName = strDiskName ' Report.ExportOptions.DestinationType = crEDTDiskFile ' Report.ExportOptions.FormatType = crEFTExcel80 ' Report.Export False ' MsgBox "Report was successfully exported to " + strDiskName, vbInformation, "Information" ' End If 'End Sub '