VERSION 5.00
Object = "{86CF1D34-0C5F-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCT2.OCX"
Object = "{00025600-0000-0000-C000-000000000046}#5.2#0"; "Crystl32.OCX"
Begin VB.Form frmStudentList 
   Caption         =   "Student's List Report"
   ClientHeight    =   1890
   ClientLeft      =   60
   ClientTop       =   450
   ClientWidth     =   3330
   ControlBox      =   0   'False
   LinkTopic       =   "Form1"
   LockControls    =   -1  'True
   MDIChild        =   -1  'True
   ScaleHeight     =   1890
   ScaleWidth      =   3330
   Begin VB.Frame fraDates 
      Height          =   1680
      Left            =   105
      TabIndex        =   0
      Top             =   120
      Width           =   3165
      Begin Crystal.CrystalReport crStudList 
         Left            =   2670
         Top             =   540
         _ExtentX        =   741
         _ExtentY        =   741
         _Version        =   348160
         PrintFileLinesPerPage=   60
      End
      Begin VB.CommandButton cmdClose 
         Caption         =   "&Close"
         Height          =   345
         Left            =   2010
         TabIndex        =   7
         Top             =   1185
         Width           =   795
      End
      Begin VB.CommandButton cmdPrint 
         Caption         =   "&Print"
         Height          =   345
         Left            =   1155
         TabIndex        =   6
         Top             =   1185
         Width           =   795
      End
      Begin VB.CommandButton cmdPreview 
         Caption         =   "Pre&view"
         Height          =   345
         Left            =   300
         TabIndex        =   5
         Top             =   1185
         Width           =   795
      End
      Begin MSComCtl2.DTPicker dtpFrom 
         Height          =   315
         Left            =   945
         TabIndex        =   3
         Top             =   240
         Width           =   1305
         _ExtentX        =   2302
         _ExtentY        =   556
         _Version        =   393216
         CustomFormat    =   "dd/MMM/yyyy"
         Format          =   20578307
         CurrentDate     =   38763
         MinDate         =   2
      End
      Begin MSComCtl2.DTPicker dtpTo 
         Height          =   315
         Left            =   945
         TabIndex        =   4
         Top             =   600
         Width           =   1305
         _ExtentX        =   2302
         _ExtentY        =   556
         _Version        =   393216
         CustomFormat    =   "dd/MMM/yyyy"
         Format          =   20578307
         CurrentDate     =   38763
         MinDate         =   2
      End
      Begin VB.Label lblTo 
         AutoSize        =   -1  'True
         Caption         =   "To"
         BeginProperty Font 
            Name            =   "Tahoma"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   195
         Left            =   375
         TabIndex        =   2
         Top             =   585
         Width           =   180
      End
      Begin VB.Label lblFrom 
         AutoSize        =   -1  'True
         Caption         =   "&From"
         BeginProperty Font 
            Name            =   "Tahoma"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   195
         Left            =   345
         TabIndex        =   1
         Top             =   240
         Width           =   360
      End
   End
End
Attribute VB_Name = "frmStudentList"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit

Private Sub cmdClose_Click()
    Unload Me
End Sub

Private Sub cmdPreview_Click()
    Call prepareReport
    With crStudList
        .WindowState = crptMaximized
        .Destination = crptToWindow
        .Action = 1
    End With
End Sub

Private Sub prepareReport()
    Dim dStartDate As Date
    Dim dEndDate As Date
    dStartDate = Format(dtpFrom.Value, "dd/MM/yyyy")
    dEndDate = Format(dtpTo.Value, "dd/MM/yyyy")
    With crStudList
        .Connect = strConn
        .ReportFileName = App.Path & "\reports\StudentList.rpt"
        .ReportTitle = "Student List"
        .WindowTitle = "Student List"
        .SelectionFormula = "{tblStudent.RegistrationDate}>=#" & Format(dStartDate, "dd/MM/yyyy") & "# and {tblStudent.RegistrationDate}<=#" & dEndDate & "#"
    End With
End Sub

Private Sub cmdPrint_Click()
    Call prepareReport
    With crStudList
        .Destination = crptToPrinter
        .Action = 1
    End With
End Sub

Private Sub Form_Load()
    Me.Move 0, 0, 3450, 2400
    dtpFrom.Value = Date
    dtpTo.Value = Date
End Sub
