📄 frmrewpun.frm
字号:
VERSION 5.00
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
Object = "{0ECD9B60-23AA-11D0-B351-00A0C9055D8E}#6.0#0"; "MSHFLXGD.OCX"
Begin VB.Form frmrewpun
BackColor = &H00C0C0FF&
BorderStyle = 1 'Fixed Single
Caption = "寝室奖励与违纪信息"
ClientHeight = 7335
ClientLeft = 2790
ClientTop = 2625
ClientWidth = 10695
LinkTopic = "Form1"
MaxButton = 0 'False
Picture = "frmrewpun.frx":0000
ScaleHeight = 7335
ScaleWidth = 10695
Begin VB.CommandButton cmdprint
BackColor = &H00C0C0FF&
Caption = "导出打印"
Enabled = 0 'False
BeginProperty Font
Name = "宋体"
Size = 18
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 615
Left = 1440
Style = 1 'Graphical
TabIndex = 12
Top = 6000
Width = 1695
End
Begin VB.ComboBox txtroom
BackColor = &H00C0E0FF&
Height = 300
ItemData = "frmrewpun.frx":2DB36
Left = 5640
List = "frmrewpun.frx":2DB3D
TabIndex = 11
Top = 1440
Width = 1335
End
Begin VB.ComboBox txtdong
BackColor = &H00C0E0FF&
Height = 300
ItemData = "frmrewpun.frx":2DB47
Left = 1920
List = "frmrewpun.frx":2DB69
TabIndex = 10
Top = 1440
Width = 1455
End
Begin MSHierarchicalFlexGridLib.MSHFlexGrid myflexgrid
Height = 3255
Left = 240
TabIndex = 9
Top = 2640
Width = 9255
_ExtentX = 16325
_ExtentY = 5741
_Version = 393216
Rows = 18
Cols = 8
AllowUserResizing= 3
RowSizingMode = 1
_NumberOfBands = 1
_Band(0).Cols = 8
End
Begin MSComctlLib.StatusBar StatusBar1
Align = 2 'Align Bottom
Height = 375
Left = 0
TabIndex = 8
Top = 6960
Width = 10695
_ExtentX = 18865
_ExtentY = 661
_Version = 393216
BeginProperty Panels {8E3867A5-8586-11D1-B16A-00C0F0283628}
NumPanels = 1
BeginProperty Panel1 {8E3867AB-8586-11D1-B16A-00C0F0283628}
AutoSize = 1
Object.Width = 18812
Picture = "frmrewpun.frx":2DB95
Text = "寝室奖励与违纪信息查询"
TextSave = "寝室奖励与违纪信息查询"
EndProperty
EndProperty
End
Begin VB.CommandButton Command2
BackColor = &H00C0C0FF&
Caption = "退出查询"
Height = 495
Left = 7680
Style = 1 'Graphical
TabIndex = 7
Top = 1680
Width = 1215
End
Begin VB.CheckBox Check2
BackColor = &H00C0FFC0&
Caption = "选择寝室号:"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 3600
TabIndex = 6
Top = 1320
Width = 1935
End
Begin VB.CheckBox Check1
BackColor = &H00C0FFC0&
Caption = "选择栋号:"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 240
TabIndex = 5
Top = 1320
Width = 1695
End
Begin VB.PictureBox SubWizard1
Height = 30
Left = 720
ScaleHeight = 30
ScaleWidth = 375
TabIndex = 4
Top = 1200
Width = 375
End
Begin VB.Frame Frame2
BackColor = &H00FF80FF&
Height = 255
Left = 120
TabIndex = 3
Top = 2160
Width = 8775
End
Begin VB.CommandButton cominquire
BackColor = &H00C0C0FF&
Caption = "查询"
Height = 495
Left = 7680
Style = 1 'Graphical
TabIndex = 2
Top = 960
Width = 1215
End
Begin VB.Frame Frame1
BackColor = &H00FF80FF&
Height = 255
Left = 120
TabIndex = 1
Top = 600
Width = 8775
End
Begin VB.Label Label1
BackStyle = 0 'Transparent
Caption = "寝室奖励与违纪信息查询"
BeginProperty Font
Name = "方正舒体"
Size = 15.75
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 3840
TabIndex = 0
Top = 6120
Width = 3735
End
End
Attribute VB_Name = "frmrewpun"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim txtSQL As String
Private Sub DTPicker1_CallbackKeyDown(ByVal KeyCode As Integer, ByVal Shift As Integer, ByVal CallbackField As String, CallbackDate As Date)
End Sub
Private Sub cmdprint_Click()
Dim i As Integer, j As Integer
'Dim txtSQL As String
Dim MsgText As String
Dim expworkbook As Excel.Workbook
Dim expexcel As Excel.Application
Dim mrc As ADODB.Recordset
Set expexcel = New Excel.Application
expexcel.Visible = True
expexcel.SheetsInNewWorkbook = 1
Set expworkbook = expexcel.Workbooks.Add
Call ConnectString
' txtSQL = "select * from hygiene_check "
'myflexgrid
' ConnectDB
'Set mrc = mrc.Execute("select * from hygiene_check")
Set mrc = ExecuteSQL(txtSQL, MsgText)
For i = 0 To mrc.Fields.Count - 1
expexcel.Cells(2, i + 1) = mrc.Fields(i).Name
Next
mrc.MoveFirst
For j = 1 To myflexgrid.Rows
For i = 0 To mrc.Fields.Count - 1
expexcel.Cells(j + 2, i + 1) = CStr(mrc.Fields(i))
Next
mrc.MoveNext
If mrc.EOF Then Exit For
Next
Set expexcel = Nothing
End Sub
Private Sub cominquire_Click()
' Dim txtSQL As String
Dim MsgText As String
Dim dd(4) As Boolean
Dim mrc As ADODB.Recordset
Dim sMeg As String
txtSQL = "select * from reward_punish where "
If Check1.Value Then
If Trim(txtdong.Text) = "" Then
sMeg = "栋号不能为空"
MsgBox sMeg, vbOKOnly + vbExclamation, "警告"
txtdong.SetFocus
Exit Sub
Else
If Not IsNumeric(Trim(txtdong.Text)) Then
MsgBox "请输入栋号数字!", vbOKOnly + vbExclamation, "警告"
Exit Sub
txtdong.SetFocus
End If
dd(0) = True
txtSQL = txtSQL & "栋号= '" & Val(Trim(txtdong.Text)) & "'"
End If
End If
If Check2.Value Then
If Trim(txtroom.Text) = "" Then
sMeg = "寝室号不能为空"
MsgBox sMeg, vbOKOnly + vbExclamation, "警告"
txtroom.SetFocus
Exit Sub
Else
dd(1) = True
If dd(0) Then
txtSQL = txtSQL & "and 寝室号= '" & txtroom.Text & "'"
Else
txtSQL = txtSQL & "寝室号 = '" & txtroom.Text & "'"
End If
End If
End If
If Not (dd(0) Or dd(1)) Then
MsgBox "请设置查询方式!", vbOKOnly + vbExclamation, "警告"
Exit Sub
End If
txtSQL = txtSQL & " order by 栋号,寝室号"
Set mrc = ExecuteSQL(txtSQL, MsgText)
If mrc.RecordCount > 0 Then
cmdprint.Enabled = True
Else
cmdprint.Enabled = False
End If
With myflexgrid
.Rows = 2
.CellAlignment = 4
.TextMatrix(1, 0) = "栋号"
.TextMatrix(1, 1) = "寝室号"
.TextMatrix(1, 2) = "年级"
.TextMatrix(1, 3) = "学院"
.TextMatrix(1, 4) = "专业"
.TextMatrix(1, 5) = "奖励情况"
.TextMatrix(1, 6) = "违纪情况"
.TextMatrix(1, 7) = "电话"
Do While Not mrc.EOF
.Rows = .Rows + 1
.CellAlignment = 4
.TextMatrix(.Rows - 1, 0) = mrc.Fields(0)
.TextMatrix(.Rows - 1, 1) = mrc.Fields(1)
.TextMatrix(.Rows - 1, 2) = mrc.Fields(2)
.TextMatrix(.Rows - 1, 3) = mrc.Fields(3)
.TextMatrix(.Rows - 1, 4) = mrc.Fields(4)
.TextMatrix(.Rows - 1, 5) = mrc.Fields(6)
.TextMatrix(.Rows - 1, 6) = mrc.Fields(7)
.TextMatrix(.Rows - 1, 7) = mrc.Fields(8)
mrc.MoveNext
Loop
End With
mrc.Close
End Sub
Private Sub Command1_Click()
End Sub
Private Sub Command2_Click()
Unload Me
End Sub
Private Sub MSHFlexGrid1_Click()
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -