📄 frmdaxbzycx.frm
字号:
VERSION 5.00
Object = "{DD44C0E7-B2CF-11D1-8DD3-444553540000}#1.0#0"; "cell32.ocx"
Begin VB.Form frmDaxbzycx
BorderStyle = 1 'Fixed Single
Caption = "按系别专业查询档案"
ClientHeight = 6795
ClientLeft = 120
ClientTop = 1515
ClientWidth = 11745
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 6795
ScaleWidth = 11745
Begin VB.CommandButton Command3
Caption = "返回(X)"
Height = 375
Left = 6120
TabIndex = 6
Top = 6360
Width = 1215
End
Begin VB.CommandButton Command2
Caption = "打印(&P)"
Enabled = 0 'False
Height = 375
Left = 4800
TabIndex = 5
Top = 6360
Width = 1215
End
Begin VB.CommandButton Command1
Caption = "查询(&Q)"
Height = 375
Left = 3480
TabIndex = 4
Top = 6360
Width = 1215
End
Begin VB.Frame Frame1
Caption = "查询方式"
Height = 660
Left = 120
TabIndex = 7
Top = 120
Width = 8175
Begin VB.ComboBox Combo2
Height = 300
Left = 6000
Style = 2 'Dropdown List
TabIndex = 3
Top = 225
Width = 1935
End
Begin VB.ComboBox Combo1
Height = 300
Left = 3000
Style = 2 'Dropdown List
TabIndex = 2
Top = 225
Width = 2055
End
Begin VB.TextBox Text1
Height = 270
Left = 720
TabIndex = 1
Top = 225
Width = 1215
End
Begin VB.Label Label3
Caption = "专业:"
Height = 255
Left = 5520
TabIndex = 10
Top = 285
Width = 735
End
Begin VB.Label Label2
Caption = "系别:"
Height = 255
Left = 2520
TabIndex = 9
Top = 285
Width = 735
End
Begin VB.Label Label1
Caption = "年级:"
Height = 255
Left = 240
TabIndex = 8
Top = 285
Width = 735
End
End
Begin CELLLib.Cell Cell1
Height = 5295
Left = 120
TabIndex = 0
TabStop = 0 'False
Top = 840
Width = 11415
_Version = 65536
_ExtentX = 20135
_ExtentY = 9340
_StockProps = 0
PageLabelVisible= 0 'False
EnablePopMenu = 0 'False
GridReadOnly = -1 'True
End
End
Attribute VB_Name = "frmDaxbzycx"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
Dim numI As Integer
Dim strExec As String
If Text1.Text <> "" Or Combo1.Text <> "" Or Combo2.Text <> "" Then
strExec = "Select a.xm,a.xh,a.csny,a.xb,a.mz,a.zzmm,a.nj,a.bj,b.xbmc,c.zymc From XSDAB a,XBMCB b,ZYMCB c Where " & _
"a.xbbh=b.xbbh And a.zybh=c.zybh And "
If Text1.Text <> "" Then
strExec = strExec & "a.nj='" & Text1.Text & "' And "
End If
If Combo1.Text <> "" Then
strExec = strExec & "a.xbbh=(Select xbbh From XBMCB Where xbmc='" & Combo1.Text & "') And "
End If
If Combo2.Text <> "" Then
strExec = strExec & "a.zybh=(Select zybh From ZYMCB Where zymc='" & Combo2.Text & "') And "
End If
strExec = Mid(strExec, 1, Len(strExec) - 5)
Set objRs = objCon.Execute(strExec)
If objRs.EOF Then
MsgBox "没有找到任何记录,请检查您的查询条件!", vbCritical, "系统信息"
Command2.Enabled = False
Else
Command2.Enabled = True
numI = 1
Cell1.DoResetContent
Cell1_Setup Cell1
Do While Not objRs.EOF
Cell1.DoAppendRow 1
Cell1.DoSetCellString 0, numI, Trim(objRs("xh"))
Cell1.DoSetCellString 1, numI, Trim(objRs("xm"))
Cell1.DoSetCellString 2, numI, Trim(objRs("csny"))
Cell1.DoSetCellString 3, numI, Trim(objRs("xb"))
Cell1.DoSetCellString 4, numI, Trim(objRs("mz"))
Cell1.DoSetCellString 5, numI, Trim(objRs("zzmm"))
Cell1.DoSetCellString 6, numI, Trim(objRs("nj"))
Cell1.DoSetCellString 7, numI, Trim(objRs("xbmc"))
Cell1.DoSetCellString 8, numI, Trim(objRs("zymc"))
Cell1.DoSetCellString 9, numI, Trim(objRs("bj"))
objRs.MoveNext
numI = numI + 1
Loop
End If
objRs.Close
End If
End Sub
Private Sub Command2_Click()
MsgBox "请在打印机中放入A4打印纸...", vbOKOnly, "数据打印"
Load FrmPrePrint
' 复制数据到打印窗口中
Cell1.DoCopyArea 0, 0, Cell1.Cols - 1, Cell1.Rows - 1
FrmPrePrint.Cell1.DoPaste 0, 0, True
FrmPrePrint.Cell1.Cols = Cell1.Cols
FrmPrePrint.Cell1.Rows = Cell1.Rows
' 设置报表标题
FrmPrePrint.Cell1.DoInsertRow 0, 1
FrmPrePrint.Cell1.DoJoinCells 0, 0, FrmPrePrint.Cell1.Cols - 1, 0
FrmPrePrint.Cell1.DoSetRowHeight 0, 60
FrmPrePrint.Cell1.DoSetCellFont 0, 0, 12, 1, "宋体" '16号宋体字,粗体
FrmPrePrint.Cell1.DoSetCellString 0, 0, Trim(Combo1.Text) & Trim(Combo2.Text) & IIf(Len(Trim(Text1.Text)) = 0, "", Trim(Text1.Text) & "级") & " 学生档案"
FrmPrePrint.Cell1.DoSetCellAlignment 0, 0, 36
' 设置页脚
FrmPrePrint.Cell1.DoSetPrintFoot "", "&P &D", ""
' 显示网格
FrmPrePrint.Cell1.DoDrawLine 0, 1, FrmPrePrint.Cell1.Cols, FrmPrePrint.Cell1.Rows, 0, 1, 0
' 设置打印属性
FrmPrePrint.Cell1.DoSetPrintPara 1, 9, False
' 预览打印报表
FrmPrePrint.Cell1.DoPrintPreview True
Unload FrmPrePrint
End Sub
Private Sub Form_Load()
Set objRs = objCon.Execute("Select Distinct xbmc From XBMCB")
Do While Not objRs.EOF
Combo1.AddItem Trim((objRs("xbmc")))
objRs.MoveNext
Loop
Set objRs = objCon.Execute("Select Distinct zymc From ZYMCB")
Do While Not objRs.EOF
Combo2.AddItem Trim((objRs("zymc")))
objRs.MoveNext
Loop
If Combo1.ListCount > 0 Then
Combo1.ListIndex = 0
End If
If Combo2.ListCount > 0 Then
Combo2.ListIndex = 0
End If
Cell1_Setup Cell1
End Sub
Private Sub Form_Unload(Cancel As Integer)
FrmMain.Enabled = True
End Sub
Private Sub Command3_Click()
Unload frmDaxbzycx
FrmMain.Enabled = True
End Sub
Private Sub Cell1_Setup(ByRef obj As Object)
Dim numI As Integer
obj.GridReadOnly = True
obj.EnablePopMenu = False
obj.PageLabelVisible = False
Cell1.SideLabelVisible = False
obj.TopLabelHeight = False
obj.Cols = 10
obj.Rows = 1
obj.DoSetCellString -1, 0, "编号"
obj.DoSetCellString 0, 0, "学号"
obj.DoSetCellString 1, 0, "姓名"
obj.DoSetCellString 2, 0, "出生年月"
obj.DoSetCellString 3, 0, "性别"
obj.DoSetCellString 4, 0, "民族"
obj.DoSetCellString 5, 0, "政治面貌"
obj.DoSetCellString 6, 0, "年级"
obj.DoSetCellString 7, 0, "系别"
obj.DoSetCellString 8, 0, "专业"
obj.DoSetCellString 9, 0, "班级"
For numI = -1 To 9
obj.DoSetCellAlignment numI, 0, 36
Next
obj.DoSetColWidth 0, 80
obj.DoSetColWidth 7, 128
obj.DoSetColWidth 8, 128
obj.DoSetDefaultFont 8, 0, "宋体"
obj.DoRedrawAll
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -