📄 年级课程表查询窗体.frm
字号:
VERSION 5.00
Begin VB.Form Frmgradefind
BackColor = &H00FFC0C0&
Caption = "Form1"
ClientHeight = 3195
ClientLeft = 60
ClientTop = 345
ClientWidth = 4680
LinkTopic = "Form1"
ScaleHeight = 3195
ScaleWidth = 4680
StartUpPosition = 3 '窗口缺省
WindowState = 2 'Maximized
Begin VB.ComboBox Combo1
BeginProperty Font
Name = "隶书"
Size = 36
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00C00000&
Height = 840
Left = 9360
TabIndex = 0
Top = 1320
Width = 3735
End
Begin VB.CommandButton Command2
BackColor = &H00FFC0C0&
Caption = "退出本界面"
BeginProperty Font
Name = "隶书"
Size = 36
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 1095
Left = 9600
TabIndex = 2
Top = 8160
Width = 4335
End
Begin VB.CommandButton command1
BackColor = &H00FFC0C0&
Caption = "查询课程表"
BeginProperty Font
Name = "隶书"
Size = 36
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 1095
Left = 1200
TabIndex = 1
Top = 8160
Width = 4215
End
Begin VB.Label Label1
BackStyle = 0 'Transparent
Caption = "请输入要查询的年级编号:"
BeginProperty Font
Name = "隶书"
Size = 36
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00C00000&
Height = 735
Left = 720
TabIndex = 3
Top = 1320
Width = 9255
End
End
Attribute VB_Name = "Frmgradefind"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim xlapp As Excel.Application
Dim xlbook As Excel.Workbook
Dim xlsheet As Excel.Worksheet
Dim db As DAO.Database
Dim rst As DAO.Recordset
Option Explicit
Private Sub Command2_Click()
Unload Me
frmmain.Show vbModal
End Sub
Private Sub Form_Load()
Combo1.AddItem Year(Now())
Combo1.AddItem Year(Now()) - 1
End Sub
Private Sub Command1_Click()
Dim a As String
Dim i As Integer, j As Integer
Set db = DBEngine.Workspaces(0).OpenDatabase("d:\coursetable.mdb")
Set rst = db.OpenRecordset("select * from coursegrade")
rst.Filter = "gradeid='" & Combo1.Text & "'"
Set rst = rst.OpenRecordset()
Set xlapp = New Excel.Application
Set xlbook = xlapp.Workbooks.Open("d:\课程表模板.xlt")
xlapp.Visible = True
Set xlsheet = xlbook.Worksheets("年级课程表")
xlsheet.Activate
xlsheet.Cells(5, 1) = Combo1.Text & "级"
xlsheet.Cells(5, 6) = Date
If rst.Fields("11") = "1" Or rst.Fields("11") = "a" Then
xlsheet.Cells(9, 3) = ""
Else
xlsheet.Cells(9, 3) = rst.Fields("11")
End If
If rst.Fields("21") = "1" Or rst.Fields("21") = "a" Then
xlsheet.Cells(9, 4) = ""
Else
xlsheet.Cells(9, 4) = rst.Fields("21")
End If
If rst.Fields("31") = "1" Or rst.Fields("31") = "a" Then
xlsheet.Cells(9, 5) = ""
Else
xlsheet.Cells(9, 5) = rst.Fields("31")
End If
If rst.Fields("41") = "1" Or rst.Fields("41") = "a" Then
xlsheet.Cells(9, 6) = ""
Else
xlsheet.Cells(9, 6) = rst.Fields("41")
End If
If rst.Fields("51") = "1" Or rst.Fields("51") = "a" Then
xlsheet.Cells(9, 7) = ""
Else
xlsheet.Cells(9, 7) = rst.Fields("51")
End If
If rst.Fields("12") = "1" Or rst.Fields("12") = "a" Then
xlsheet.Cells(13, 3) = ""
Else
xlsheet.Cells(13, 3) = rst.Fields("12")
End If
If rst.Fields("22") = "1" Or rst.Fields("22") = "a" Then
xlsheet.Cells(13, 4) = ""
Else
xlsheet.Cells(13, 4) = rst.Fields("22")
End If
If rst.Fields("32") = "1" Or rst.Fields("32") = "a" Then
xlsheet.Cells(13, 5) = ""
Else
xlsheet.Cells(13, 5) = rst.Fields("32")
End If
If rst.Fields("42") = "1" Or rst.Fields("42") = "a" Then
xlsheet.Cells(13, 6) = ""
Else
xlsheet.Cells(13, 6) = rst.Fields("42")
End If
If rst.Fields("52") = "1" Or rst.Fields("52") = "a" Then
xlsheet.Cells(13, 7) = ""
Else
xlsheet.Cells(13, 7) = rst.Fields("52")
End If
If rst.Fields("13") = "1" Or rst.Fields("13") = "a" Then
xlsheet.Cells(17, 3) = ""
Else
xlsheet.Cells(17, 3) = rst.Fields("13")
End If
If rst.Fields("23") = "1" Or rst.Fields("23") = "a" Then
xlsheet.Cells(17, 4) = ""
Else
xlsheet.Cells(17, 4) = rst.Fields("23")
End If
If rst.Fields("33") = "1" Or rst.Fields("33") = "a" Then
xlsheet.Cells(17, 5) = ""
Else
xlsheet.Cells(17, 5) = rst.Fields("33")
End If
If rst.Fields("43") = "1" Or rst.Fields("43") = "a" Then
xlsheet.Cells(17, 6) = ""
Else
xlsheet.Cells(17, 6) = rst.Fields("43")
End If
If rst.Fields("53") = "1" Or rst.Fields("53") = "a" Then
xlsheet.Cells(17, 7) = ""
Else
xlsheet.Cells(17, 7) = rst.Fields("53")
End If
If rst.Fields("41") = "1" Or rst.Fields("41") = "a" Then
xlsheet.Cells(21, 3) = ""
Else
xlsheet.Cells(21, 3) = rst.Fields("14")
End If
If rst.Fields("24") = "1" Or rst.Fields("24") = "a" Then
xlsheet.Cells(21, 4) = ""
Else
xlsheet.Cells(21, 4) = rst.Fields("24")
End If
If rst.Fields("34") = "1" Or rst.Fields("34") = "a" Then
xlsheet.Cells(21, 5) = ""
Else
xlsheet.Cells(21, 5) = rst.Fields("34")
End If
If rst.Fields("44") = "1" Or rst.Fields("44") = "a" Then
xlsheet.Cells(21, 6) = ""
Else
xlsheet.Cells(21, 6) = rst.Fields("44")
End If
If rst.Fields("54") = "1" Or rst.Fields("54") = "a" Then
xlsheet.Cells(21, 7) = ""
Else
xlsheet.Cells(21, 7) = rst.Fields("54")
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -