📄 专业课程表查询窗体.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 frmfind
BackColor = &H00FFC0C0&
Caption = "专业课程表查询界面"
ClientHeight = 3195
ClientLeft = 60
ClientTop = 345
ClientWidth = 4680
LinkTopic = "Form1"
ScaleHeight = 3195
ScaleWidth = 4680
StartUpPosition = 3 'Windows Default
WindowState = 2 'Maximized
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 = 9960
TabIndex = 4
Top = 9360
Width = 4095
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 = &H00C00000&
Height = 855
Left = 10200
TabIndex = 0
Top = 960
Width = 3375
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 = 735
Left = 720
TabIndex = 2
Top = 9360
Width = 4095
End
Begin MSDataGridLib.DataGrid DataGrid1
Bindings = "专业课程表查询窗体.frx":0000
Height = 6495
Left = 1560
TabIndex = 1
Top = 2400
Width = 12135
_ExtentX = 21405
_ExtentY = 11456
_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 = "majorid"
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 = "majorname"
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 = 3344.882
EndProperty
BeginProperty Column01
ColumnWidth = 8430.236
EndProperty
EndProperty
End
Begin MSAdodcLib.Adodc Adodc1
Height = 615
Left = 1440
Top = 120
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 majorid,majorname from major order by majorid"
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 = 1560
TabIndex = 3
Top = 960
Width = 8895
End
End
Attribute VB_Name = "frmfind"
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 dbcourse As DAO.Database
Dim rst As DAO.Recordset
Dim rstclass As DAO.Recordset
Dim db As DAO.Database
Dim rstclasscourse As DAO.Recordset
Option Explicit
Private Sub Command1_Click()
Dim a(5, 4) As String
a(1, 1) = ""
a(1, 2) = ""
a(1, 3) = ""
a(1, 4) = ""
a(2, 1) = ""
a(2, 2) = ""
a(2, 3) = ""
a(2, 4) = ""
a(3, 1) = ""
a(3, 2) = ""
a(3, 3) = ""
a(3, 4) = ""
a(4, 1) = ""
a(4, 2) = ""
a(4, 3) = ""
a(4, 4) = ""
a(5, 1) = ""
a(5, 2) = ""
a(5, 3) = ""
a(5, 4) = ""
Dim i As Integer, j As Integer
Set db = DBEngine.Workspaces(0).OpenDatabase("d:\basic.mdb")
Set dbcourse = DBEngine.Workspaces(0).OpenDatabase("d:\coursetable.mdb")
Set rst = dbcourse.OpenRecordset("select * from coursemajor")
rst.Filter = "majorid='" & Text1.Text & "'"
Set rst = rst.OpenRecordset()
Set rstclass = db.OpenRecordset("select * from class")
rstclass.Filter = "majorid='" & Text1.Text & "'"
Set rstclass = rstclass.OpenRecordset()
Set xlapp = New Excel.Application
Set xlbook = xlapp.Workbooks.Open("d:\课程表模板.xlt")
xlapp.Visible = True
Set xlsheet = xlbook.Worksheets("专业课程表")
xlsheet.Cells(5, 1) = DataGrid1.Columns(1).Text
xlsheet.Cells(5, 6) = Date
xlsheet.Activate
If rst.Fields("11") = "a" Then
xlsheet.Cells(9, 3) = ""
Else
If rst.Fields("11") = 1 Then
a(1, 1) = ""
Else
a(1, 1) = rst.Fields("11")
End If
If rstclass.RecordCount() <> 0 Then
rstclass.MoveFirst
Do Until rstclass.EOF
Set rstclasscourse = dbcourse.OpenRecordset("select * from courseclass")
rstclasscourse.Filter = "classid='" & rstclass.Fields("classid") & "'"
Set rstclasscourse = rstclasscourse.OpenRecordset()
If rstclasscourse.Fields("11") = "1" Or rstclasscourse.Fields("11") = "a" Then
a(1, 1) = a(1, 1)
Else
If a(1, 1) = "" Then
a(1, 1) = rstclasscourse.Fields("11")
Else
a(1, 1) = a(1, 1) & vbNewLine & rstclasscourse.Fields("11")
End If
End If
rstclass.MoveNext
Loop
End If
xlsheet.Cells(9, 3) = a(1, 1)
End If
If rst.Fields("21") = "a" Then
xlsheet.Cells(9, 4) = ""
Else
If rst.Fields("21") = "1" Then
a(2, 1) = ""
Else
a(2, 1) = rst.Fields("21")
If rstclass.RecordCount() <> 0 Then
rstclass.MoveFirst
Do Until rstclass.EOF
Set rstclasscourse = dbcourse.OpenRecordset("select * from courseclass")
rstclasscourse.Filter = "classid='" & rstclass.Fields("classid") & "'"
Set rstclasscourse = rstclasscourse.OpenRecordset()
If rstclasscourse.Fields("21") = "1" Or rstclasscourse.Fields("21") = "a" Then
a(2, 1) = a(2, 1)
Else
If a(2, 1) = "" Then
a(2, 1) = rstclasscourse.Fields("21")
Else
a(2, 1) = a(2, 1) & vbNewLine & rstclasscourse.Fields("21")
End If
End If
rstclass.MoveNext
Loop
End If
xlsheet.Cells(9, 4) = a(2, 1)
End If
If rst.Fields("31") = "a" Then
xlsheet.Cells(9, 5) = ""
Else
If rst.Fields("31") = "1" Then
a(3, 1) = ""
Else
a(3, 1) = rst.Fields("31")
End If
If rstclass.RecordCount() <> 0 Then
rstclass.MoveFirst
Do Until rstclass.EOF
Set rstclasscourse = dbcourse.OpenRecordset("select * from courseclass")
rstclasscourse.Filter = "classid='" & rstclass.Fields("classid") & "'"
Set rstclasscourse = rstclasscourse.OpenRecordset()
If rstclasscourse.Fields("31") = "1" Or rstclasscourse.Fields("31") = "a" Then
a(3, 1) = a(3, 1)
Else
If a(3, 1) = "" Then
a(3, 1) = rstclasscourse.Fields("31")
Else
a(3, 1) = a(3, 1) & vbNewLine & rstclasscourse.Fields("31")
End If
End If
rstclass.MoveNext
Loop
End If
xlsheet.Cells(9, 5) = a(3, 1)
End If
If rst.Fields("41") = "a" Then
xlsheet.Cells(9, 6) = ""
Else
If rst.Fields("41") = "1" Then
a(4, 1) = ""
Else
a(4, 1) = rst.Fields("41")
End If
If rstclass.RecordCount() <> 0 Then
rstclass.MoveFirst
Do Until rstclass.EOF
Set rstclasscourse = dbcourse.OpenRecordset("select * from courseclass")
rstclasscourse.Filter = "classid='" & rstclass.Fields("classid") & "'"
Set rstclasscourse = rstclasscourse.OpenRecordset()
If rstclasscourse.Fields("41") = "1" Or rstclasscourse.Fields("41") = "a" Then
a(4, 1) = a(4, 1)
Else
If a(4, 1) = "" Then
a(4, 1) = rstclasscourse.Fields("41")
Else
a(4, 1) = a(4, 1) & vbNewLine & rstclasscourse.Fields("41")
End If
End If
rstclass.MoveNext
Loop
End If
xlsheet.Cells(9, 6) = a(4, 1)
End If
If rst.Fields("51") = "a" Then
xlsheet.Cells(9, 7) = ""
Else
If rst.Fields("51") = "1" Then
a(5, 1) = ""
Else
a(5, 1) = rst.Fields("51")
End If
If rstclass.RecordCount() <> 0 Then
rstclass.MoveFirst
Do Until rstclass.EOF
Set rstclasscourse = dbcourse.OpenRecordset("select * from courseclass")
rstclasscourse.Filter = "classid='" & rstclass.Fields("classid") & "'"
Set rstclasscourse = rstclasscourse.OpenRecordset()
If rstclasscourse.Fields("51") = "1" Or rstclasscourse.Fields("51") = "a" Then
a(5, 1) = a(5, 1)
Else
If a(5, 1) = "" Then
a(5, 1) = rstclasscourse.Fields("51")
Else
a(5, 1) = a(5, 1) & vbNewLine & rstclasscourse.Fields("51")
End If
End If
rstclass.MoveNext
Loop
End If
xlsheet.Cells(9, 7) = a(5, 1)
End If
If rst.Fields("12") = "a" Then
xlsheet.Cells(13, 3) = ""
Else
If rst.Fields("12") = "1" Then
a(1, 2) = ""
Else
a(1, 2) = rst.Fields("12")
End If
If rstclass.RecordCount() <> 0 Then
rstclass.MoveFirst
Do Until rstclass.EOF
Set rstclasscourse = dbcourse.OpenRecordset("select * from courseclass")
rstclasscourse.Filter = "classid='" & rstclass.Fields("classid") & "'"
Set rstclasscourse = rstclasscourse.OpenRecordset()
If rstclasscourse.Fields("12") = "1" Or rstclasscourse.Fields("12") = "a" Then
a(1, 2) = a(1, 2)
Else
If a(1, 2) = "" Then
a(1, 2) = rstclasscourse.Fields("12")
Else
a(1, 2) = a(1, 2) & vbNewLine & rstclasscourse.Fields("12")
End If
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -