📄 form6.frm
字号:
VERSION 5.00
Begin VB.Form Form6
Caption = "打印"
ClientHeight = 3030
ClientLeft = 60
ClientTop = 345
ClientWidth = 7560
LinkTopic = "Form6"
MaxButton = 0 'False
ScaleHeight = 3030
ScaleWidth = 7560
StartUpPosition = 3 '窗口缺省
Begin VB.ComboBox Combo4
Height = 300
Left = 2280
TabIndex = 7
Text = "Combo1"
Top = 2160
Width = 2175
End
Begin VB.TextBox Text1
Height = 375
Left = 3120
TabIndex = 6
Text = "Text1"
Top = 4200
Width = 495
End
Begin VB.ComboBox Combo3
Height = 300
Left = 4560
TabIndex = 5
Text = "Combo1"
Top = 2160
Width = 2175
End
Begin VB.ComboBox Combo2
Height = 300
Left = 2520
TabIndex = 4
Text = "Combo1"
Top = 1200
Width = 2175
End
Begin VB.ComboBox Combo1
Height = 300
Left = 2520
TabIndex = 3
Text = "Combo1"
Top = 360
Width = 2175
End
Begin VB.CommandButton Command3
Caption = "按教师"
Height = 495
Left = 720
TabIndex = 2
Top = 2040
Width = 1335
End
Begin VB.CommandButton Command2
Caption = "教室"
Height = 495
Left = 720
TabIndex = 1
Top = 1200
Width = 1335
End
Begin VB.CommandButton Command1
Caption = "按班级"
Height = 495
Left = 720
TabIndex = 0
Top = 360
Width = 1335
End
End
Attribute VB_Name = "Form6"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim Classprint As New OpenRs '定义打印记录集
Dim xlApp As New Excel.Application
Dim sendsql As String
Dim array1(0 To 100) As String
Dim array2(0 To 100) As String
Dim array3(0 To 100) As String
Dim array_long As Integer '数组需求长度
Dim InsertStr As String '保存相应的课表空间
Dim insertInt As Integer '保存相应的空间数
Public je As Integer '记忆菜单上次数值,实现数据传送
'临时教师代课表
Dim ttCon As ADODB.Connection
Dim ttrs As ADODB.Recordset
'trClass表
Dim trcon As ADODB.Connection
Dim trrs As ADODB.Recordset
Dim sqlStr As String
Dim trname As String
Dim wStr(5) As String
Dim clStr(5) As String
Private Sub Command1_Click()
On Error GoTo finish
If Combo1.Text = "" Then
MsgBox "班级名称不可为空,请选择班级", vbInformation, "提示"
End If
sendsql = "select 临时生成表.时间段,星期一,星期二,星期三,星期四,星期五,星期六,星期日,所属班级,一,二,三,四,五,六,日,班级 from 临时生成表,对应教师表 where 所属班级='" & Combo1.Text & "' and 班级='" & Combo1.Text & "' and 临时生成表.时间段=对应教师表.时间段 order by 临时生成表.自动编号 asc"
MDIForm1.WindowState = 2
Classprint.rsDK1 sendsql
ClassReport.Show '显示报表
Set ClassReport.DataSource = Classprint.rs1 '报表的数据源是 Classprint模块中的rs1
Exit Sub
finish:
MsgBox Err.Description
End Sub
Private Sub Command2_Click()
Dim mycn As New ADODB.Connection
Dim myrs As New ADODB.Recordset
Set myrs = New ADODB.Recordset
mycn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=base.mdb;"
myrs.Open "SELECT * FROM 班级名称 where 教室号='" + Combo2.Text + "';", mycn, adOpenKeyset, adLockOptimistic
On Error GoTo finish
If Combo2.Text = "" Then
MsgBox "班级名称不可为空,请选择班级", vbInformation, "提示"
End If
Text1.Text = "04计算机一班"
sendsql = "select 临时生成表.时间段,星期一,星期二,星期三,星期四,星期五,星期六,星期日,所属班级,一,二,三,四,五,六,日,班级 from 临时生成表,对应教师表 where 所属班级='" & Text1.Text & "' and 班级='" & Text1.Text & "' and 临时生成表.时间段=对应教师表.时间段 order by 临时生成表.自动编号 asc"
MDIForm1.WindowState = 2
Classprint.rsDK1 sendsql
ClassReport.Show '显示报表
Set ClassReport.DataSource = Classprint.rs1 '报表的数据源是 Classprint模块中的rs1
Exit Sub
finish:
MsgBox Err.Description
End Sub
Private Sub Command3_Click()
On Error GoTo finish
If Combo3.Text = "" Then
MsgBox "班级名称不可为空,请选择班级", vbInformation, "提示"
End If
sendsql = "select 临时生成表.时间段,星期一,星期二,星期三,星期四,星期五,星期六,星期日,所属班级,一,二,三,四,五,六,日,班级 from 临时生成表,对应教师表 where 所属班级='" & Combo4.Text & "' and 班级='" & Combo4.Text & "' and (一 ='" & Combo3.Text & "' or 二='" & Combo3.Text & "'or 三='" & Combo3.Text & "'or 四='" & Combo3.Text & "'or 五='" & Combo3.Text & "'or 六='" & Combo3.Text & "'or 日='" & Combo3.Text & "') and 临时生成表.时间段=对应教师表.时间段 order by 临时生成表.自动编号 asc"
MDIForm1.WindowState = 2
Classprint.rsDK1 sendsql
ClassReport.Show '显示报表
Set ClassReport.DataSource = Classprint.rs1 '报表的数据源是 Classprint模块中的rs1
Exit Sub
finish:
MsgBox Err.Description
End Sub
Private Sub Form_Load()
Combo1.Clear '清空xpcombo的集合内容
Set kc2 = cnn.Execute("select 班级名称 from 班级名称")
Do While Not kc2.EOF '将所有班级名称加入xpcombo1集合
Combo1.AddItem kc2.Fields(0)
kc2.MoveNext
Loop
Combo2.Clear '清空xpcombo的集合内容
Set kc2 = cnn.Execute("select 教室名称 from 公共教室")
Do While Not kc2.EOF '将所有班级名称加入xpcombo1集合
Combo2.AddItem kc2.Fields(0)
kc2.MoveNext
Loop
Combo3.Clear '清空xpcombo的集合内容
Set kc2 = cnn.Execute("select 任课老师 from 课程信息")
Do While Not kc2.EOF '将所有班级名称加入xpcombo1集合
Combo3.AddItem kc2.Fields(0)
kc2.MoveNext
Loop
Combo4.Clear '清空xpcombo的集合内容
Set kc2 = cnn.Execute("select 班级名称 from 班级名称")
Do While Not kc2.EOF '将所有班级名称加入xpcombo1集合
Combo4.AddItem kc2.Fields(0)
kc2.MoveNext
Loop
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -