📄 教师课程表查询窗体.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 Frmteacherfind
BackColor = &H00FFC0C0&
Caption = "教师课程表查询和打印界面"
ClientHeight = 3195
ClientLeft = 60
ClientTop = 345
ClientWidth = 4680
LinkTopic = "Form1"
ScaleHeight = 11115
ScaleWidth = 15240
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 = 1095
Left = 960
TabIndex = 2
Top = 9240
Width = 4455
End
Begin VB.TextBox Text1
BeginProperty Font
Name = "楷体_GB2312"
Size = 36
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00800000&
Height = 855
Left = 9600
TabIndex = 1
Top = 600
Width = 3375
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 = 0
Top = 9240
Width = 4455
End
Begin MSDataGridLib.DataGrid DataGrid1
Bindings = "教师课程表查询窗体.frx":0000
Height = 6975
Left = 2280
TabIndex = 3
Top = 2040
Width = 9495
_ExtentX = 16748
_ExtentY = 12303
_Version = 393216
AllowUpdate = -1 'True
ForeColor = 12582912
HeadLines = 1
RowHeight = 27
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 = 18
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Caption = "教师编号与教师姓名对照表"
ColumnCount = 2
BeginProperty Column00
DataField = "teacherid"
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 = "teachername"
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 = 3795.024
EndProperty
BeginProperty Column01
ColumnWidth = 5249.764
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 teacherid,teachername from teacher order by teacherid"
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
BackStyle = 0 'Transparent
Caption = "请输入要查询的教师编号:"
BeginProperty Font
Name = "隶书"
Size = 36
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00800000&
Height = 735
Left = 720
TabIndex = 4
Top = 720
Width = 9135
End
End
Attribute VB_Name = "Frmteacherfind"
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 courseteacher")
rst.Filter = "teacherid='" & 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()
Frmteacherfind.Cls
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 + -