⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 studentsschedule.dsr

📁 数据库
💻 DSR
字号:
VERSION 5.00
Begin {82282820-C017-11D0-A87C-00A0C90F29FC} rptStudentsSchedule 
   Caption         =   "Students Schedule"
   ClientHeight    =   11325
   ClientLeft      =   165
   ClientTop       =   450
   ClientWidth     =   14670
   StartUpPosition =   3  'Windows Default
   _ExtentX        =   25876
   _ExtentY        =   19976
   SectionData     =   "StudentsSchedule.dsx":0000
End
Attribute VB_Name = "rptStudentsSchedule"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit

Dim iOrientationSav As Integer

Private Sub ActiveReport_Initialize()
    dcRptData.DatabaseName = App.Path & "\Students And Classes.mdb"
End Sub

Private Sub ActiveReport_PageStart()
Dim pic As IPictureDisp
Dim t As Long, l As Long, w As Long, h As Long


    Set pic = LoadPicture(App.Path & "\PageGraphic.WMF")
    w = 1 * 1440    ' 2 inches
    h = 1 * 1440    ' 2 inches
    t = Canvas.Height - PageBottomMargin - h
    l = PageLeftMargin
    Canvas.DrawPicture pic, l, t, w, h
End Sub

Private Sub ActiveReport_ReportEnd()
    ' Be a good citizen and restore the printer settings
    Printer.Orientation = iOrientationSav
End Sub

Private Sub ActiveReport_ReportStart()
    ' Let's Print This in Landscape
    iOrientationSav = Printer.Orientation
    Printer.Orientation = ddOLandscape
    
    ghStudentID.GroupValue = dcRptData.Recordset.Fields("StudentID").Value
End Sub

Private Sub Detail_Format()
Dim sDays As String
Dim sHour As String
Dim iPos As Integer
Dim sCtl As String, sCtlValue As String
Dim i As Integer
Dim j As Integer

Static bErased As Boolean
Static iRec As Integer

    ' Default the record number
    If iRec = 0 Then iRec = 1
    
    If dcRptData.Recordset.Fields("StudentID").Value <> txtStudentID.DataValue Then
        txtStudentID.DataValue = dcRptData.Recordset.Fields("StudentID").Value
        LayoutAction = ddLAPrintSection Or ddLAMoveLayout
        bErased = False
        Exit Sub
    End If
    
    ghStudentID.GroupValue = dcRptData.Recordset.Fields("StudentID").Value
        
    If Not bErased Then
        ' Clean up the schedule labels from the previous record
        For i = 0 To Detail.Controls.Count - 1
            If InStr("lblM_lblT_lblW_lblR_lblF", Left$(Detail.Controls(i).Name, 4)) > 0 Then
                Detail.Controls(i).Caption = ""
            End If
        Next i
        bErased = True
    End If
    
    sDays = dcRptData.Recordset.Fields("DaysAndTimes").Value
    Debug.Print txtLastName.Text, sDays, dcRptData.Recordset.Fields("ClassName").Value
    ' Parse the schedule days and times
    iPos = InStr(sDays, " ")
    If iPos > 0 Then
        sHour = Mid$(sDays, iPos + 1, 2) ' All classes start on the hour
        sDays = Mid$(sDays, 1, iPos - 1)
        For i = 1 To iPos - 1
            sCtl = "lbl" & Mid$(sDays, i, 1) & sHour
            sCtlValue = dcRptData.Recordset.Fields("ClassName").Value & " @ " & _
                    dcRptData.Recordset.Fields("Location").Value & vbCrLf & _
                    dcRptData.Recordset.Fields("Instructor").Value
            Detail.Controls(sCtl).Caption = sCtlValue
             
        Next
    Else
        ' Soemthing wrong with the string
    End If
    
    ' If this is the not last record
    If iRec < dcRptData.Recordset.RecordCount Then
        iRec = iRec + 1
        LayoutAction = ddLANextRecord
    End If
    ' Else leave layout action to default NextRecord Or PrintSection Or MoveLayout
    
End Sub

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -