📄 教室课程表查询打印窗体.frm
字号:
VERSION 5.00
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Object = "{CDE57A40-8B86-11D0-B3C6-00A0C90AEA82}#1.0#0"; "MSDATGRD.OCX"
Begin VB.Form Frmclassroomfind
BackColor = &H00FFC0C0&
Caption = "教室课程表查询窗体"
ClientHeight = 3195
ClientLeft = 60
ClientTop = 345
ClientWidth = 4680
LinkTopic = "Form1"
ScaleHeight = 3195
ScaleWidth = 4680
StartUpPosition = 3 '窗口缺省
WindowState = 2 'Maximized
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 = 735
Left = 960
TabIndex = 2
Top = 9600
Width = 4695
End
Begin VB.TextBox Text1
BeginProperty Font
Name = "楷体_GB2312"
Size = 26.25
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 855
Left = 11040
TabIndex = 0
Top = 600
Width = 3855
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 = 735
Left = 10200
TabIndex = 1
Top = 9600
Width = 4215
End
Begin MSDataGridLib.DataGrid DataGrid1
Bindings = "教室课程表查询打印窗体.frx":0000
Height = 6615
Left = 720
TabIndex = 3
Top = 2160
Width = 13815
_ExtentX = 24368
_ExtentY = 11668
_Version = 393216
AllowUpdate = -1 'True
ForeColor = 12582912
HeadLines = 1
RowHeight = 31
FormatLocked = -1 'True
BeginProperty HeadFont {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "隶书"
Size = 21.75
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "楷体_GB2312"
Size = 20.25
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Caption = "教室编号与教室名称对照表"
ColumnCount = 2
BeginProperty Column00
DataField = "classroomid"
Caption = "教室编号"
BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED}
Type = 0
Format = ""
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 2052
SubFormatType = 0
EndProperty
EndProperty
BeginProperty Column01
DataField = "classroomname"
Caption = "教室名称"
BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED}
Type = 0
Format = ""
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 2052
SubFormatType = 0
EndProperty
EndProperty
SplitCount = 1
BeginProperty Split0
BeginProperty Column00
ColumnWidth = 2940.095
EndProperty
BeginProperty Column01
ColumnWidth = 10530.14
EndProperty
EndProperty
End
Begin MSAdodcLib.Adodc Adodc1
Height = 615
Left = 480
Top = 0
Visible = 0 'False
Width = 1935
_ExtentX = 3413
_ExtentY = 1085
ConnectMode = 0
CursorLocation = 3
IsolationLevel = -1
ConnectionTimeout= 15
CommandTimeout = 30
CursorType = 3
LockType = 3
CommandType = 1
CursorOptions = 0
CacheSize = 50
MaxRecords = 0
BOFAction = 0
EOFAction = 0
ConnectStringType= 1
Appearance = 1
BackColor = -2147483643
ForeColor = -2147483640
Orientation = 0
Enabled = -1
Connect = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\basic.mdb;Persist Security Info=False"
OLEDBString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\basic.mdb;Persist Security Info=False"
OLEDBFile = ""
DataSourceName = ""
OtherAttributes = ""
UserName = ""
Password = ""
RecordSource = "select classroomid,classroomname from classroom order by classroomid"
Caption = "Adodc1"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
_Version = 393216
End
Begin VB.Label Label1
BackColor = &H00C00000&
BackStyle = 0 'Transparent
Caption = "请输入要查询的教室编号:"
BeginProperty Font
Name = "隶书"
Size = 42
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 1575
Left = 360
TabIndex = 4
Top = 480
Width = 10335
End
End
Attribute VB_Name = "Frmclassroomfind"
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 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 courseclassroom")
rst.Filter = "classroomid='" & Text1.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) = DataGrid1.Columns(1).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
Private Sub Command2_Click()
Unload Me
frmmain.Show vbModal
End Sub
Private Sub DataGrid1_Click()
Text1.Text = DataGrid1.Columns(0).Text
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -