473,573 Members | 2,447 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

executing a report takes a very long time

Hello All

I have designed a dotnet application using VB which basically takes a
selection and passes value to a crystal report which in turn passes the
value to a Stored procedure. After the report gets generated it is PDF'ed -
all this is done thru a single click in my program.

Now the catch here is that through the program all these tasks of generating
the report and PDF'ing 1400 records (about 25 pages) takes 15 minutes.

I executed the SP through analyzer and to generate the 1300 records it takes
about 4 seconds. I executed the information thru Crystal Reports 8.5 and to
generate the report with the parameters it takes less than a minute. To
export to a PDF version from the Drop Down Menu choice, it took about 15
seconds.

It seems to me that when I add the .Net app layer it adds on the extra time.
I am a newbie to dot net. Please advise.. Below is the code that I am using.

Imports CrystalDecision s.CrystalReport s.Engine
Imports CrystalDecision s.Shared
Imports System.IO
Imports System
Imports System.Drawing
Imports System.Windows. Forms
Imports System.Data.Sql Client
Public Class frmCRReport
Inherits System.Windows. Forms.Form
Dim crParameterFiel dDefinitions As ParameterFieldD efinitions
Dim crParameterDisc reteValue As ParameterDiscre teValue
Dim crParameterValu es As ParameterValues
Dim crParameterValu es2 As ParameterValues
Dim crParameterValu es3 As ParameterValues
Dim crParameterValu es4 As ParameterValues
Dim crConnectionInf o As ConnectionInfo
Dim crExportOptions As ExportOptions
Dim crDiskFileDesti nationOptions As DiskFileDestina tionOptions
Dim crLogonInfo As TableLogOnInfo
Dim response As Integer
Dim response1 As Integer
Dim msg As Integer
Dim msg1 As Integer
Dim oRpt As ReportDocument
Dim crview As New CRView()
Dim i As Integer
Dim BegDate As Date
Dim DateVal As Date
Dim YTD As String
Dim disptext As String
Dim dtFolder As String
Dim Exportpath As String
Dim exportFilePath As String
Dim ExportFileName As String
Dim dlg As System.IO.Direc toryInfo
Dim dlg1 As New OpenFileDialog( )
Dim dlg2 As New SaveFileDialog( )
Dim dirpath As String
Dim undwrtr As String
#Region " Windows Form Designer generated code "
Public Sub New()
MyBase.New()
'This call is required by the Windows Form Designer.
InitializeCompo nent()
'Add any initialization after the InitializeCompo nent() call
End Sub
'Form overrides dispose to clean up the component list.
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Disp ose()
End If
End If
MyBase.Dispose( disposing)
End Sub
'Required by the Windows Form Designer
Private components As System.Componen tModel.IContain er
'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
Friend WithEvents CheckedListBox1 As System.Windows. Forms.CheckedLi stBox
Friend WithEvents cmdEnd As System.Windows. Forms.Button
Friend WithEvents Label1 As System.Windows. Forms.Label
Friend WithEvents DateTimePicker1 As System.Windows. Forms.DateTimeP icker
Friend WithEvents DateTimePicker2 As System.Windows. Forms.DateTimeP icker
Friend WithEvents Label3 As System.Windows. Forms.Label
Friend WithEvents cboMonth As System.Windows. Forms.ComboBox
Friend WithEvents lblDirPath As System.Windows. Forms.Label
Friend WithEvents btnDirPath As System.Windows. Forms.Button
Friend WithEvents RichTextBox1 As System.Windows. Forms.RichTextB ox
Friend WithEvents Label2 As System.Windows. Forms.Label
Friend WithEvents Label4 As System.Windows. Forms.Label
Friend WithEvents Label5 As System.Windows. Forms.Label
Friend WithEvents Label8 As System.Windows. Forms.Label
Friend WithEvents btnSavRpt As System.Windows. Forms.Button
Friend WithEvents lblSavPath As System.Windows. Forms.Label
Friend WithEvents CheckedListBox2 As System.Windows. Forms.CheckedLi stBox
Friend WithEvents Label6 As System.Windows. Forms.Label
Friend WithEvents btnRunReports As System.Windows. Forms.Button
<System.Diagnos tics.DebuggerSt epThrough()> Private Sub InitializeCompo nent()
Me.CheckedListB ox1 = New System.Windows. Forms.CheckedLi stBox()
Me.cmdEnd = New System.Windows. Forms.Button()
Me.DateTimePick er1 = New System.Windows. Forms.DateTimeP icker()
Me.DateTimePick er2 = New System.Windows. Forms.DateTimeP icker()
Me.Label3 = New System.Windows. Forms.Label()
Me.cboMonth = New System.Windows. Forms.ComboBox( )
Me.lblDirPath = New System.Windows. Forms.Label()
Me.btnDirPath = New System.Windows. Forms.Button()
Me.RichTextBox1 = New System.Windows. Forms.RichTextB ox()
Me.Label2 = New System.Windows. Forms.Label()
Me.Label4 = New System.Windows. Forms.Label()
Me.Label5 = New System.Windows. Forms.Label()
Me.Label8 = New System.Windows. Forms.Label()
Me.btnSavRpt = New System.Windows. Forms.Button()
Me.lblSavPath = New System.Windows. Forms.Label()
Me.CheckedListB ox2 = New System.Windows. Forms.CheckedLi stBox()
Me.Label6 = New System.Windows. Forms.Label()
Me.btnRunReport s = New System.Windows. Forms.Button()
Me.SuspendLayou t()
'
'CheckedListBox 1
'
Me.CheckedListB ox1.Items.AddRa nge(New Object() {"1400 - Test"})
Me.CheckedListB ox1.Location = New System.Drawing. Point(112, 176)
Me.CheckedListB ox1.Name = "CheckedListBox 1"
Me.CheckedListB ox1.Size = New System.Drawing. Size(272, 229)
Me.CheckedListB ox1.Sorted = True
Me.CheckedListB ox1.TabIndex = 5
'
'cmdEnd
'
Me.cmdEnd.BackC olor = System.Drawing. Color.LightGray
Me.cmdEnd.Font = New System.Drawing. Font("Microsoft Sans Serif", 8.25!,
System.Drawing. FontStyle.Bold, System.Drawing. GraphicsUnit.Po int, CType(0,
Byte))
Me.cmdEnd.ForeC olor = System.Drawing. Color.Maroon
Me.cmdEnd.Locat ion = New System.Drawing. Point(512, 368)
Me.cmdEnd.Name = "cmdEnd"
Me.cmdEnd.Size = New System.Drawing. Size(168, 32)
Me.cmdEnd.TabIn dex = 24
Me.cmdEnd.Text = "End"
'
'DateTimePicker 1
'
Me.DateTimePick er1.CustomForma t = "mm/dd/yyyy"
Me.DateTimePick er1.Format = System.Windows. Forms.DateTimeP ickerFormat.Sho rt
Me.DateTimePick er1.Location = New System.Drawing. Point(392, 312)
Me.DateTimePick er1.Name = "DateTimePicker 1"
Me.DateTimePick er1.Size = New System.Drawing. Size(104, 20)
Me.DateTimePick er1.TabIndex = 7
Me.DateTimePick er1.Value = New Date(2003, 4, 16, 0, 0, 0, 0)
'
'DateTimePicker 2
'
Me.DateTimePick er2.Format = System.Windows. Forms.DateTimeP ickerFormat.Sho rt
Me.DateTimePick er2.Location = New System.Drawing. Point(520, 312)
Me.DateTimePick er2.Name = "DateTimePicker 2"
Me.DateTimePick er2.Size = New System.Drawing. Size(96, 20)
Me.DateTimePick er2.TabIndex = 9
'
'Label3
'
Me.Label3.BackC olor = System.Drawing. Color.DarkGreen
Me.Label3.Borde rStyle = System.Windows. Forms.BorderSty le.Fixed3D
Me.Label3.Font = New System.Drawing. Font("Arial Black", 26.25!,
System.Drawing. FontStyle.Bold, System.Drawing. GraphicsUnit.Po int, CType(0,
Byte))
Me.Label3.ForeC olor = System.Drawing. Color.LightGold enrodYellow
Me.Label3.Locat ion = New System.Drawing. Point(-8, 0)
Me.Label3.Name = "Label3"
Me.Label3.Size = New System.Drawing. Size(936, 72)
Me.Label3.TabIn dex = 1
Me.Label3.Text = "REPORTS"
Me.Label3.TextA lign = System.Drawing. ContentAlignmen t.TopCenter
'
'cboMonth
'
Me.cboMonth.Ite ms.AddRange(New Object() {"January", "February", "March",
"April", "May", "June", "July", "August", "September" , "October",
"November", "December"} )
Me.cboMonth.Loc ation = New System.Drawing. Point(392, 344)
Me.cboMonth.Nam e = "cboMonth"
Me.cboMonth.Siz e = New System.Drawing. Size(112, 21)
Me.cboMonth.Tab Index = 20
Me.cboMonth.Tex t = "Select a Month"
'
'lblDirPath
'
Me.lblDirPath.B orderStyle = System.Windows. Forms.BorderSty le.FixedSingle
Me.lblDirPath.F ont = New System.Drawing. Font("Microsoft Sans Serif", 12.0!,
System.Drawing. FontStyle.Bold, System.Drawing. GraphicsUnit.Po int, CType(0,
Byte))
Me.lblDirPath.F oreColor = System.Drawing. Color.DarkBlue
Me.lblDirPath.L ocation = New System.Drawing. Point(296, 80)
Me.lblDirPath.N ame = "lblDirPath "
Me.lblDirPath.S ize = New System.Drawing. Size(536, 32)
Me.lblDirPath.T abIndex = 3
Me.lblDirPath.T ext = "M:\MIS\Program ming\Reports"
'
'btnDirPath
'
Me.btnDirPath.B ackColor = System.Drawing. Color.LightGray
Me.btnDirPath.F ont = New System.Drawing. Font("Microsoft Sans Serif", 8.25!,
System.Drawing. FontStyle.Bold, System.Drawing. GraphicsUnit.Po int, CType(0,
Byte))
Me.btnDirPath.F oreColor = System.Drawing. Color.Maroon
Me.btnDirPath.L ocation = New System.Drawing. Point(104, 80)
Me.btnDirPath.N ame = "btnDirPath "
Me.btnDirPath.S ize = New System.Drawing. Size(192, 32)
Me.btnDirPath.T abIndex = 2
Me.btnDirPath.T ext = "Set Report Location Path"
'
'RichTextBox1
'
Me.RichTextBox1 .BorderStyle = System.Windows. Forms.BorderSty le.FixedSingle
Me.RichTextBox1 .Location = New System.Drawing. Point(104, 512)
Me.RichTextBox1 .Name = "RichTextBo x1"
Me.RichTextBox1 .Size = New System.Drawing. Size(784, 160)
Me.RichTextBox1 .TabIndex = 25
Me.RichTextBox1 .Text = ""
'
'Label2
'
Me.Label2.Borde rStyle = System.Windows. Forms.BorderSty le.FixedSingle
Me.Label2.Font = New System.Drawing. Font("Microsoft Sans Serif", 8.25!,
System.Drawing. FontStyle.Bold, System.Drawing. GraphicsUnit.Po int, CType(0,
Byte))
Me.Label2.ForeC olor = System.Drawing. Color.DarkBlue
Me.Label2.Locat ion = New System.Drawing. Point(392, 288)
Me.Label2.Name = "Label2"
Me.Label2.Size = New System.Drawing. Size(72, 16)
Me.Label2.TabIn dex = 6
Me.Label2.Text = "Begin Date"
'
'Label4
'
Me.Label4.Borde rStyle = System.Windows. Forms.BorderSty le.FixedSingle
Me.Label4.Font = New System.Drawing. Font("Microsoft Sans Serif", 8.25!,
System.Drawing. FontStyle.Bold, System.Drawing. GraphicsUnit.Po int, CType(0,
Byte))
Me.Label4.ForeC olor = System.Drawing. Color.DarkBlue
Me.Label4.Locat ion = New System.Drawing. Point(520, 288)
Me.Label4.Name = "Label4"
Me.Label4.Size = New System.Drawing. Size(64, 16)
Me.Label4.TabIn dex = 8
Me.Label4.Text = "End Date"
'
'Label5
'
Me.Label5.Borde rStyle = System.Windows. Forms.BorderSty le.FixedSingle
Me.Label5.Font = New System.Drawing. Font("Microsoft Sans Serif", 8.25!,
System.Drawing. FontStyle.Bold, System.Drawing. GraphicsUnit.Po int, CType(0,
Byte))
Me.Label5.ForeC olor = System.Drawing. Color.DarkBlue
Me.Label5.Locat ion = New System.Drawing. Point(112, 152)
Me.Label5.Name = "Label5"
Me.Label5.Size = New System.Drawing. Size(96, 16)
Me.Label5.TabIn dex = 4
Me.Label5.Text = "Select Group(s)"
'
'Label8
'
Me.Label8.BackC olor = System.Drawing. Color.DarkGreen
Me.Label8.Locat ion = New System.Drawing. Point(0, 72)
Me.Label8.Name = "Label8"
Me.Label8.Size = New System.Drawing. Size(96, 680)
Me.Label8.TabIn dex = 41
'
'btnSavRpt
'
Me.btnSavRpt.Ba ckColor = System.Drawing. Color.LightGray
Me.btnSavRpt.Fo nt = New System.Drawing. Font("Microsoft Sans Serif", 8.25!,
System.Drawing. FontStyle.Bold, System.Drawing. GraphicsUnit.Po int, CType(0,
Byte))
Me.btnSavRpt.Fo reColor = System.Drawing. Color.Maroon
Me.btnSavRpt.Lo cation = New System.Drawing. Point(104, 112)
Me.btnSavRpt.Na me = "btnSavRpt"
Me.btnSavRpt.Si ze = New System.Drawing. Size(192, 32)
Me.btnSavRpt.Ta bIndex = 42
Me.btnSavRpt.Te xt = "Set Report Export Path"
'
'lblSavPath
'
Me.lblSavPath.B orderStyle = System.Windows. Forms.BorderSty le.FixedSingle
Me.lblSavPath.F ont = New System.Drawing. Font("Microsoft Sans Serif", 12.0!,
System.Drawing. FontStyle.Bold, System.Drawing. GraphicsUnit.Po int, CType(0,
Byte))
Me.lblSavPath.F oreColor = System.Drawing. Color.DarkBlue
Me.lblSavPath.L ocation = New System.Drawing. Point(296, 112)
Me.lblSavPath.N ame = "lblSavPath "
Me.lblSavPath.S ize = New System.Drawing. Size(536, 32)
Me.lblSavPath.T abIndex = 43
'
'CheckedListBox 2
'
Me.CheckedListB ox2.Items.AddRa nge(New Object() {"Class Statistical Report -
All Funds"})
Me.CheckedListB ox2.Location = New System.Drawing. Point(392, 176)
Me.CheckedListB ox2.Name = "CheckedListBox 2"
Me.CheckedListB ox2.Size = New System.Drawing. Size(256, 109)
Me.CheckedListB ox2.TabIndex = 44
'
'Label6
'
Me.Label6.Borde rStyle = System.Windows. Forms.BorderSty le.FixedSingle
Me.Label6.Font = New System.Drawing. Font("Microsoft Sans Serif", 8.25!,
System.Drawing. FontStyle.Bold, System.Drawing. GraphicsUnit.Po int, CType(0,
Byte))
Me.Label6.ForeC olor = System.Drawing. Color.DarkBlue
Me.Label6.Locat ion = New System.Drawing. Point(392, 152)
Me.Label6.Name = "Label6"
Me.Label6.Size = New System.Drawing. Size(144, 16)
Me.Label6.TabIn dex = 45
Me.Label6.Text = "Select Report(s) to Run"
'
'btnRunReports
'
Me.btnRunReport s.BackColor = System.Drawing. Color.LightGray
Me.btnRunReport s.Font = New System.Drawing. Font("Microsoft Sans Serif",
8.25!, System.Drawing. FontStyle.Bold, System.Drawing. GraphicsUnit.Po int,
CType(0, Byte))
Me.btnRunReport s.ForeColor = System.Drawing. Color.Maroon
Me.btnRunReport s.Location = New System.Drawing. Point(512, 336)
Me.btnRunReport s.Name = "btnRunRepo rts"
Me.btnRunReport s.Size = New System.Drawing. Size(168, 32)
Me.btnRunReport s.TabIndex = 46
Me.btnRunReport s.Text = "Run Selected Reports"
'
'frmCRReport
'
Me.AutoScaleBas eSize = New System.Drawing. Size(5, 13)
Me.AutoScroll = True
Me.AutoScrollMa rgin = New System.Drawing. Size(10, 10)
Me.BackColor = System.Drawing. Color.PaleGolde nrod
Me.ClientSize = New System.Drawing. Size(774, 555)
Me.Controls.Add Range(New System.Windows. Forms.Control() {Me.btnRunRepor ts,
Me.Label6, Me.CheckedListB ox2, Me.lblSavPath, Me.btnSavRpt, Me.Label8,
Me.Label5, Me.Label4, Me.Label2, Me.RichTextBox1 , Me.btnDirPath,
Me.lblDirPath, Me.cboMonth, Me.Label3, Me.cmdEnd, Me.CheckedListB ox1,
Me.DateTimePick er1, Me.DateTimePick er2})
Me.FormBorderSt yle = System.Windows. Forms.FormBorde rStyle.Fixed3D
Me.Name = "frmCRRepor t"
Me.Text = "Benesys Eldorado Special Processing Reports"
Me.WindowState = System.Windows. Forms.FormWindo wState.Maximize d
Me.ResumeLayout (False)
End Sub
#End Region
Private Sub frmCRReport_Loa d(ByVal sender As System.Object, ByVal e As
System.EventArg s) Handles MyBase.Load
Dim myConnectionStr ing As String
Dim dataset1 As DataSet
CheckedListBox1 .CheckOnClick = True
CheckedListBox2 .CheckOnClick = True

End Sub

Public Sub connectDB()
crLogonInfo = oRpt.Database.T ables(0).LogOnI nfo
crLogonInfo.Con nectionInfo.Ser verName = "XXXX"
crLogonInfo.Con nectionInfo.Use rID = "XXXXXXXXXX X"
crLogonInfo.Con nectionInfo.Pas sword = "XXXXXXXX"
crLogonInfo.Con nectionInfo.Dat abaseName = "XXXXXXXXXX X"
oRpt.Database.T ables(0).ApplyL ogOnInfo(crLogo nInfo)
End Sub

Public Sub PDFDoc()
crDiskFileDesti nationOptions = New DiskFileDestina tionOptions()
crDiskFileDesti nationOptions.D iskFileName = exportFilePath
crExportOptions = oRpt.ExportOpti ons
With crExportOptions
..DestinationOp tions = crDiskFileDesti nationOptions
..ExportDestina tionType = ExportDestinati onType.DiskFile
..ExportFormatT ype = ExportFormatTyp e.PortableDocFo rmat
End With
oRpt.Export()
End Sub

Public Function checkFund()
If CheckedListBox1 .CheckedItems.C ount = 0 Then
MsgBox("No Group has been selected. You must select atleast one group to run
the report", MsgBoxStyle.OKO nly)
CheckedListBox1 .Focus()
checkFund = 1
Exit Function
End If
checkFund = 0
End Function
Public Sub FundBegDates()
YTD = ""
If Mid(CheckedList Box1.CheckedIte ms(i), 1, 4) = "1400" Then
YTD = "05/01/"
End If
End Sub

Public Sub getParams(ByVal BegDate As Date, ByVal EndDate As Date, ByVal
GroupNum As String)
crParameterFiel dDefinitions = oRpt.DataDefini tion.ParameterF ields
'Access the specified parameter from the collection
crParameterValu es =
crParameterFiel dDefinitions.It em("@BegDate"). CurrentValues
crParameterValu es2 =
crParameterFiel dDefinitions.It em("@EndDate"). CurrentValues
crParameterValu es3 =
crParameterFiel dDefinitions.It em("@GRNUM").Cu rrentValues
crParameterDisc reteValue = New ParameterDiscre teValue()
crParameterDisc reteValue.Value = GroupNum
crParameterValu es3.Add(crParam eterDiscreteVal ue)
crParameterFiel dDefinitions.It em("@GRNUM").Ap plyCurrentValue s(crParameterVa l
ues3)
'Set the current values for the numeric parameter field
crParameterDisc reteValue = New ParameterDiscre teValue()
crParameterDisc reteValue.Value = BegDate
crParameterValu es.Add(crParame terDiscreteValu e)
crParameterFiel dDefinitions.It em("@BegDate"). ApplyCurrentVal ues(crParameter V
alues)
crParameterDisc reteValue = New ParameterDiscre teValue()
crParameterDisc reteValue.Value = EndDate
crParameterValu es2.Add(crParam eterDiscreteVal ue)
crParameterFiel dDefinitions.It em("@EndDate"). ApplyCurrentVal ues(crParameter V
alues2)

undwrtr = "001"
End Sub

Public Sub ProcFund()
If msg = MsgBoxResult.Ye s Then
disptext = disptext & "Exporting Report " & ExportFileName & " to PDF in " &
exportFilePath & vbCrLf
RichTextBox1.Te xt = disptext
Call PDFDoc()
disptext = disptext & "Report(s) exported to: '" & exportFilePath & "'" &
vbCrLf
RichTextBox1.Te xt = disptext
ElseIf msg = MsgBoxResult.No Then
response = MsgBox("Do you want to view " & ExportFileName,
MsgBoxStyle.Yes No)
If response = MsgBoxResult.Ye s Then
crview.Show()
crview.CrystalR eportViewer1.Re portSource = oRpt
response1 = MsgBox("Do you want to PDF " & ExportFileName,
MsgBoxStyle.Yes No)
If response1 = MsgBoxResult.Ye s Then
disptext = disptext & "Exporting Report " & ExportFileName & " to PDF in " &
exportFilePath & vbCrLf
RichTextBox1.Te xt = disptext
Call PDFDoc()
End If
ElseIf response = MsgBoxResult.No Then
response1 = MsgBox("Do you want to PDF " & ExportFileName,
MsgBoxStyle.Yes No)
If response1 = MsgBoxResult.Ye s Then
disptext = disptext & "Exporting Report " & ExportFileName & " to PDF in " &
exportFilePath & vbCrLf
RichTextBox1.Te xt = disptext
Call PDFDoc()
End If
End If
RichTextBox1.Te xt = disptext & "Report(s) exported to: '" & exportFilePath &
"'" & vbCrLf
End If
End Sub

Public Sub LoadRpt(ByVal rptname As String)
oRpt = New ReportDocument( )
disptext = "" & vbCrLf
oRpt.Load(lblDi rPath.Text & "\" & rptname,
OpenReportMetho d.OpenReportByT empCopy)
Call connectDB()
End Sub
Public Sub procReports(ByV al Dateval1 As String, ByVal Dateval2 As Date,
ByVal expfname As String, ByVal YTDFlag As Integer)
msg = MsgBox("Do you just want to PDF all selected fund reports or view the
fund reports individually. Yes will PDF all the Funds without displaying and
No will display further options", MsgBoxStyle.Yes NoCancel)
For i = 0 To CheckedListBox1 .CheckedItems.C ount - 1
RichTextBox1.Te xt = "Processing Group # " & CheckedListBox1 .CheckedItems(i )
& ". Please Wait" & vbCrLf
If YTDFlag = 1 Then
Call FundBegDates()
BegDate = YTD & Year(Today)
If Today > BegDate Then
If Month(Today) = Month(BegDate) And Year(Today) = Year(BegDate) Then
Dateval1 = YTD & (Year(Today) - 1)
Else
Dateval1 = BegDate
End If
ElseIf Today < BegDate Then
Dateval1 = YTD & (Year(Today) - 1)
End If
End If
Call getParams(CDate (Dateval1), Dateval2,
Mid(CheckedList Box1.CheckedIte ms(i), 1, 3))
ExportFileName = Mid(CheckedList Box1.CheckedIte ms(i), 1, 4) & "_CLASS
STATISTICAL_" & expfname & ".pdf"
dtFolder = DateFunc(Year(L astDayOfMonth(T oday)),
Month(LastDayOf Month(Today)),
Microsoft.Visua lBasic.Day(Last DayOfMonth(Toda y)))
If lblSavPath.Text <> "" Then
Exportpath = lblSavPath.Text
exportFilePath = Exportpath & "\" & ExportFileName
Else
Exportpath = "L:\" & Mid(CheckedList Box1.CheckedIte ms(i), 1, 4) & "\E2\" &
dtFolder & "\"
Call CheckDir()
End If
Call ProcFund()
Next
RichTextBox1.Te xt = disptext & "Finished processing All Groups"
End Sub

Public Function FirstDayOfMonth (ByVal CurDate)
FirstDayOfMonth = DateSerial(Year (CurDate), Month(CurDate) - 1, 1)
End Function
Public Function LastDayOfMonth( ByVal CurDate)
LastDayOfMonth = DateSerial(Year (CurDate), Month(CurDate), 0)
End Function
Private Sub btnDirPath_Clic k(ByVal sender As System.Object, ByVal e As
System.EventArg s) Handles btnDirPath.Clic k
dlg1.Title = "Set Report Folder"
dlg1.Filter = "Crystal Reports (*.rpt)|*.rpt|A ll Files (*.*)|*.*"
dlg1.InitialDir ectory = "M:\MIS\Program ming\Reports\"
If dlg1.ShowDialog () = DialogResult.OK Then
lblDirPath.Text = UCase(Path.GetD irectoryName(dl g1.FileName))
End If
End Sub
Private Sub btnSavRpt_Click (ByVal sender As System.Object, ByVal e As
System.EventArg s) Handles btnSavRpt.Click
dlg2.Title = "Save Report"
dlg2.Filter = "Adobe Acrobat (*.pdf)|*.pdf|A ll Files (*.*)|*.*"
dlg2.InitialDir ectory = "L:\"
If dlg2.ShowDialog () = DialogResult.OK Then
lblSavPath.Text = UCase(Path.GetD irectoryName(dl g2.FileName))
End If
End Sub

Public Function DateFunc(ByVal YYYY As String, ByVal MM As String, ByVal DD
As String)
If MM < 10 Then
MM = "0" & MM
ElseIf DD < 10 Then
DD = "0" & DD
End If
DateFunc = YYYY & MM & DD
End Function
Public Sub CheckDir()
If Directory.Exist s(Exportpath) Then
exportFilePath = Exportpath & ExportFileName
Else
Directory.Creat eDirectory(Expo rtpath)
exportFilePath = Exportpath & ExportFileName
End If
End Sub
Private Sub cmdEnd_Click(By Val sender As System.Object, ByVal e As
System.EventArg s) Handles cmdEnd.Click
End
End Sub

Public Sub procClassStat()
If checkFund() = 1 Then
Exit Sub
End If
Call LoadRpt("AllPro ductsMonthlyCla ssStatisticalRe port_V1.rpt")
Call procReports(Fir stDayOfMonth(To day), LastDayOfMonth( Today), _
(Month(LastDayO fMonth(Today)) & "-" &
Microsoft.Visua lBasic.Day(Last DayOfMonth(Toda y)) & "-" &
Year(LastDayOfM onth(Today))), 0)
End Sub
Public Sub procClassStatBy Date()
If checkFund() = 1 Then
Exit Sub
End If
Call LoadRpt("AllPro ductsMonthlyCla ssStatisticalRe port_V1.rpt")
Call procReports(Dat eTimePicker1.Va lue, DateTimePicker2 .Value, _
(Month(DateTime Picker1.Value) & "-" &
Microsoft.Visua lBasic.Day(Date TimePicker1.Val ue) _
& "-" & Year(DateTimePi cker1.Value) & _
"_TO_" & Month(DateTimeP icker2.Value) & "-" &
Microsoft.Visua lBasic.Day(Date TimePicker2.Val ue) & _
"-" & Year(DateTimePi cker2.Value)), 0)
End Sub
Public Sub procClassStatYT D()
If checkFund() = 1 Then
Exit Sub
End If
Call LoadRpt("AllPro ductsMonthlyCla ssStatisticalRe port_V1.rpt")
Call procReports("", LastDayOfMonth( Today), _
("YTD_" & Month(LastDayOf Month(Today)) & "-" &
Microsoft.Visua lBasic.Day(Last DayOfMonth(Toda y)) & "-" &
Year(LastDayOfM onth(Today))), 1)
End Sub

Public Sub procPPOAnalysis ()
If checkFund() = 1 Then
Exit Sub
End If
Call LoadRpt("PPORep ort.rpt")
Call procReports(Dat eTimePicker1.Va lue, DateTimePicker2 .Value, _
(Month(DateTime Picker1.Value) & "-" &
Microsoft.Visua lBasic.Day(Date TimePicker1.Val ue) _
& "-" & Year(DateTimePi cker1.Value) & _
"_TO_" & Month(DateTimeP icker2.Value) & "-" & Microsoft.Visua lBasic.Day(Date
TimePicker2.Val ue) & _
"-" & Year(DateTimePi cker2.Value)), 0)
End Sub
Private Sub btnRunReports_C lick(ByVal sender As System.Object, ByVal e As
System.EventArg s) Handles btnRunReports.C lick
If CheckedListBox2 .CheckedItems.C ount = 0 Then
MsgBox("You must select at least one report to run", MsgBoxStyle.OKO nly, "
Alert")
CheckedListBox2 .Focus()
Exit Sub
End If
For i = 0 To CheckedListBox2 .CheckedItems.C ount - 1
If CheckedListBox2 .CheckedItems(i ) = "Class Statistical Report - All Funds"
Then
Call procClassStat()
End If
Next
End Sub

End Class
Nov 20 '05 #1
0 1807

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

15
11529
by: (Pete Cresswell) | last post by:
I've got a .BAT file that I use for executing various MS Access apps that I wrote way back in the days of 2.0. It's evolved over time, but it still contains a number of possible paths to MSACCESS.EXE, tries them all, takes the first one it finds, and dies if none is found. Seems to me like at some time or another I was able to clone this...
1
3848
by: Andrew | last post by:
Hi All: I am using Access2000 and I find that the command to open an Access report in preview mode is very slow: DoCmd.OpenReport rptABC, acViewPreview, "", "" The scenario is this: - The following codes are written in the VB Applcation. - Prior to opening the report, I set its recordsource with a sql: ..Reports!rptABC.RecordSource =...
6
1369
by: pnp | last post by:
Hi all, I've developed an app (C#) that connects to SQL Server 2000 without using thread pooling (using SqlConnection) and I run a query that returns ~4000 tuples each time it runs and displays the results in a listview. The problem is that after I run it 3-4 times the results are read very slowly from the DB. The first times the results are...
6
2171
by: veenakj | last post by:
Hi, I have a asp.net webpage which has aroud 20 steps as hyperlink. when start button is clicked, then step1 starts which does some operation in db and returns some value, based on that value i post the same page again to execute the next step. This continues untill the 20th step is executed. Now some steps, take lot of time to execute...
8
2004
by: Daz | last post by:
Hi everyone. I was faced with the choice of whether my problem is indeed a PHP problem or a MySQL. I have decided it's a PHP problem as I don't experience the same problem when I execute the same query at the CLI. I am having trouble executing a large query through my PHP script. It takes about 7-11 seconds on average to execute, whereas...
0
5746
by: John Smith | last post by:
Hello, I have 7 different crystal reports that need to be collated. Since I want to end up with a page of each (which all together make a single report), I created a blank main report and then added the 7 as subreports so they can print one after the other. I'm supposed to be printing them from a VB.Net 2003 application and I will be passing...
4
7220
by: Jana | last post by:
Hi! I have an Access 97 report based on tables linked to an SQL back end. The report has 5 subreports in it (unfortunately unavoidable due to the nature of the report) and performance is quite slow. The query runs quickly and the report displays the first page in a short amount of time, but takes quite a while to format each page. This...
14
23131
by: lmttag | last post by:
Hello. We're developing an ASP.NET 2.0 (C#) application and we're trying to AJAX-enable it. We're having problem with a page not showing the page while a long-running process is executing. So, we're looking for a way to display the page with a "please wait..." message while the process is running, and then, when the process is done, update...
4
2726
by: D.Stone | last post by:
I am having problems formatting an Access 2003 report which is trivial in the extreme (tabular layout, 9 fields from 1 table per row in the detail section, no groups/totals). One field (only) in the row can be longer than its text-box on rare occasions, so I've made the text-box and detail section CanGrow properties = Yes. This has had one...
0
7747
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7670
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8180
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7740
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
8036
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5557
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5263
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
1
1269
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1005
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.