📄 frmquerycount.frm
字号:
Begin VB.Menu MNUSQU
Caption = "记录查询[&S]"
End
Begin VB.Menu MNU21
Caption = "-"
End
Begin VB.Menu MNUrep
Caption = "全屏修改[&R]"
End
Begin VB.Menu MNU22
Caption = "-"
End
Begin VB.Menu MNUINPUT
Caption = "数据添加[&I]"
End
End
Begin VB.Menu MNUHELP
Caption = "【帮助&H】"
Begin VB.Menu MNUHELP1
Caption = "使用说明[&N]"
End
End
End
Attribute VB_Name = "frmPartyCount"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Public Sub GiveUp()
On Error Resume Next
Dim I As Integer
For I = 0 To 13
chkYX(I).Value = 0
Next I
For I = 0 To 29
chkSY(I).Value = 0
Next I
For I = 0 To 5
chkMZ(I).Value = 0
Next I
For I = 0 To 5
chkXL(I).Value = 0
Next
For I = 0 To 6
chkNJ(I).Value = 0
Next I
txtXM = " "
txtCount = " "
txtXH = " "
txtNJ = " "
mskZZSJfrom = "__/__/____"
mskZZSJto = "__/__/____"
mskZDSJfrom = "__/__/____"
mskZDSJto = "__/__/____"
mskTGSJfrom = "__/__/____"
mskTGSJto = "__/__/____"
End Sub
Private Sub cmdDelete_Click()
On Error Resume Next
GiveUp
End Sub
Private Sub cmdExit_Click()
On Error Resume Next
Unload Me
'Frmstart.Show
End Sub
Private Sub cmdQuery_Click()
On Error Resume Next
Dim Start As Integer '从此开始组建SQL语句
Dim EmpetyAll As Boolean '为空则无法组建SQL语句
Dim EmpetyThis As Boolean
Dim recPartyCount As Recordset
Dim I As Integer
sqlForParty = "select xh,xm,csny,mz,yx,nj,sy,xl,tgsj,zzsj,zdsj,zddd from Party where "
EmpetyAll = True
EmpetyThis = False
'寻找第一个有效选项 院系
For I = 0 To 13
Start = I
If chkYX(I).Value = 1 Then
sqlForParty = sqlForParty + "(yx='" + Trim(chkYX(I).Caption) + "' "
EmpetyAll = False
EmpetyThis = True
Exit For
End If
Next I
'组建完整的SQL语句 院系
If Start < 13 Then
For I = Start + 1 To 13
If chkYX(I).Value = 1 Then
sqlForParty = sqlForParty + "or yx='" + Trim(chkYX(I).Caption) + "' "
End If
Next I
End If
If EmpetyThis Then
sqlForParty = sqlForParty + ") "
End If
'寻找第一个有效选项 生源
EmpetyThis = False
For I = 0 To 29
Start = I
If chkSY(I).Value = 1 Then
If Right(RTrim(sqlForParty), 5) = "where" Then
sqlForParty = sqlForParty + "(sy like '" + chkSY(I).Caption + "*'"
Else
sqlForParty = sqlForParty + "and (sy like '" + chkSY(I).Caption + "*'"
End If
EmpetyAll = False
EmpetyThis = True
Exit For
End If
Next I
'组建完整的SQL语句 生源
If Start < 29 Then
For I = Start + 1 To 29
If chkSY(I).Value = 1 Then
sqlForParty = sqlForParty + "or SY like '" + chkSY(I).Caption + "*' "
End If
Next I
End If
If EmpetyThis Then
sqlForParty = sqlForParty + ") "
End If
'寻找第一个有效选项 民族
EmpetyThis = False
For I = 0 To 4
Start = I
If chkMZ(I).Value = 1 Then
If Right(RTrim(sqlForParty), 5) = "where" Then
sqlForParty = sqlForParty + "(mz='" + Trim(chkMZ(I).Caption) + "' "
Else
sqlForParty = sqlForParty + "and (mz='" + Trim(chkMZ(I).Caption) + "' "
End If
EmpetyAll = False
EmpetyThis = True
Exit For
End If
Next I
'组建完整的SQL语句 民族
If Start < 4 Then
For I = Start + 1 To 4
If chkMZ(I).Value = 1 Then
sqlForParty = sqlForParty + "or mz='" + Trim(chkMZ(I).Caption) + "' "
End If
Next I
End If
'少数民族特殊处理
If chkMZ(5).Value = 1 Then
EmpetyAll = False
EmpetyThis = True
If Right(RTrim(sqlForParty), 5) = "where" Then
sqlForParty = sqlForParty + "(mz<>'汉族' and mz<>'回族' and mz<>'满族' and mz<>'壮族' and mz<>'藏族' "
Else
If Start = 4 And chkMZ(4).Value = 0 Then
sqlForParty = sqlForParty + "and (mz<>'汉族' and mz<>'回族' and mz<>'满族' and mz<>'壮族' and mz<>'藏族' "
Else
sqlForParty = sqlForParty + "or (mz<>'汉族' and mz<>'回族' and mz<>'满族' and mz<>'壮族' and mz<>'藏族') "
End If
End If
End If
If EmpetyThis Then
sqlForParty = sqlForParty + ") "
End If
'寻找第一个有效选项 学历
EmpetyThis = False
For I = 0 To 5
Start = I
If chkXL(I).Value = 1 Then
If Right(RTrim(sqlForParty), 5) = "where" Then
sqlForParty = sqlForParty + "(xl='" + Trim(chkXL(I).Caption) + "' "
Else
sqlForParty = sqlForParty + "and (xl='" + Trim(chkXL(I).Caption) + "' "
End If
EmpetyAll = False
EmpetyThis = True
Exit For
End If
Next I
'组建完整的SQL语句 学历
If Start < 5 Then
For I = Start + 1 To 5
If chkXL(I).Value = 1 Then
sqlForParty = sqlForParty + "or xl='" + Trim(chkXL(I).Caption) + "' "
End If
Next I
End If
If EmpetyThis Then
sqlForParty = sqlForParty + ") "
End If
'寻找第一个有效选项 年级
EmpetyThis = False
For I = 0 To 6
Start = I
If chkNJ(I).Value = 1 Then
If Right(RTrim(sqlForParty), 5) = "where" Then
sqlForParty = sqlForParty + "(nj='" + Trim(chkNJ(I).Caption) + "' "
Else
sqlForParty = sqlForParty + "and (nj='" + Trim(chkNJ(I).Caption) + "' "
End If
EmpetyAll = False
EmpetyThis = True
Exit For
End If
Next I
'组建完整的SQL语句 年级
If Start < 6 Then
For I = Start + 1 To 6
If chkNJ(I).Value = 1 Then
sqlForParty = sqlForParty + "or nj='" + Trim(chkNJ(I).Caption) + "' "
End If
Next I
End If
If txtNJ <> " " Then
EmpetyAll = False
If Right(RTrim(sqlForParty), 5) = "where" Then
sqlForParty = sqlForParty + "nj='" + Trim(txtNJ) + "'"
Else
sqlForParty = sqlForParty + "and nj='" + Trim(txtNJ) + "'"
End If
End If
If EmpetyThis Then
sqlForParty = sqlForParty + ") "
End If
'学号
If txtXH <> " " Then
EmpetyAll = False
If Right(RTrim(sqlForParty), 5) = "where" Then
sqlForParty = sqlForParty + "(xh like '" + Trim(txtXH) + "*') "
Else
sqlForParty = sqlForParty + "and (xh like '" + Trim(txtXH) + "*') "
End If
End If
'姓名
If txtXM <> " " Then
EmpetyAll = False
If Right(RTrim(sqlForParty), 5) = "where" Then
sqlForParty = sqlForParty + "(xm like '" + Trim(txtXM) + "*') "
Else
sqlForParty = sqlForParty + "and (xm like '" + Trim(txtXM) + "*') "
End If
End If
'通过时间
If mskTGSJfrom = "__/__/____" And mskTGSJto <> "__/__/____" Then
EmpetyAll = False
If Right(RTrim(sqlForParty), 5) = "where" Then
sqlForParty = sqlForParty + "tgsj <=" + "#" + "" + Trim(mskTGSJto.Text) + "" + "#" + " "
Else
sqlForParty = sqlForParty + "and tgsj <=" + "#" + "" + Trim(mskTGSJto.Text) + "" + "#" + " "
End If
End If
If mskTGSJfrom.Text <> "__/__/____" And mskTGSJto = "__/__/____" Then
EmpetyAll = False
If Right(RTrim(sqlForParty), 5) = "where" Then
sqlForParty = sqlForParty + "tgsj>=" + "#" + "" + Trim(mskTGSJfrom.Text) + "" + "#" + " "
Else
sqlForParty = sqlForParty + "and tgsj>=" + "#" + "" + Trim(mskTGSJfrom.Text) + "" + "#" + " "
End If
End If
If mskTGSJfrom <> "__/__/____" And mskTGSJto <> "__/__/____" Then
EmpetyAll = False
If Right(RTrim(sqlForParty), 5) = "where" Then
sqlForParty = sqlForParty + "tgsj between" + " #" + "" + Trim(mskTGSJfrom.Text) + "" + "#" + " and " + "#" + "" + Trim(mskTGSJto.Text) + "" + "#"
Else
sqlForParty = sqlForParty + "and tgsj between" + " #" + "" + Trim(mskTGSJfrom.Text) + "" + "#" + " and " + "#" + "" + Trim(mskTGSJto.Text) + "" + "#"
End If
End If
'转正时间
If mskZZSJfrom = "__/__/____" And mskZZSJto <> "__/__/____" Then
EmpetyAll = False
If Right(RTrim(sqlForParty), 5) = "where" Then
sqlForParty = sqlForParty + "zzsj <=" + "#" + "" + Trim(mskZZSJto.Text) + "" + "#" + " "
Else
sqlForParty = sqlForParty + "and zzsj <=" + "#" + "" + Trim(mskZZSJto.Text) + "" + "#" + " "
End If
End If
If mskZZSJfrom.Text <> "__/__/____" And mskZZSJto = "__/__/____" Then
EmpetyAll = False
If Right(RTrim(sqlForParty), 5) = "where" Then
sqlForParty = sqlForParty + "zzsj>=" + "#" + "" + Trim(mskZZSJfrom.Text) + "" + "#" + " "
Else
sqlForParty = sqlForParty + "and zzsj>=" + "#" + "" + Trim(mskZZSJfrom.Text) + "" + "#" + " "
End If
End If
If mskZZSJfrom <> "__/__/____" And mskZZSJto <> "__/__/____" Then
EmpetyAll = False
If Right(RTrim(sqlForParty), 5) = "where" Then
sqlForParty = sqlForParty + "zzsj between" + " #" + "" + Trim(mskZZSJfrom.Text) + "" + "#" + " and " + "#" + "" + Trim(mskTGSJto.Text) + "" + "#"
Else
sqlForParty = sqlForParty + "and zzsj between" + " #" + "" + Trim(mskZZSJfrom.Text) + "" + "#" + " and " + "#" + "" + Trim(mskTGSJto.Text) + "" + "#"
End If
End If
'转档时间
If mskZDSJfrom = "__/__/____" And mskZDSJto <> "__/__/____" Then
EmpetyAll = False
If Right(RTrim(sqlForParty), 5) = "where" Then
sqlForParty = sqlForParty + "zdsj <=" + "#" + "" + Trim(mskZDSJto.Text) + "" + "#" + " "
Else
sqlForParty = sqlForParty + "and zdsj <=" + "#" + "" + Trim(mskZDSJto.Text) + "" + "#" + " "
End If
End If
If mskZDSJfrom.Text <> "__/__/____" And mskZDSJto = "__/__/____" Then
EmpetyAll = False
If Right(RTrim(sqlForParty), 5) = "where" Then
sqlForParty = sqlForParty + "zdsj>=" + "#" + "" + Trim(mskZDSJfrom.Text) + "" + "#" + " "
Else
sqlForParty = sqlForParty + "and zdsj>=" + "#" + "" + Trim(mskZDSJfrom.Text) + "" + "#" + " "
End If
End If
If mskZDSJfrom <> "__/__/____" And mskZDSJto <> "__/__/____" Then
EmpetyAll = False
If Right(RTrim(sqlForParty), 5) = "where" Then
sqlForParty = sqlForParty + "zdsj between" + " #" + "" + Trim(mskZDSJfrom.Text) + "" + "#" + " and " + "#" + "" + Trim(mskTGSJto.Text) + "" + "#"
Else
sqlForParty = sqlForParty + "and zdsj between" + " #" + "" + Trim(mskZDSJfrom.Text) + "" + "#" + " and " + "#" + "" + Trim(mskTGSJto.Text) + "" + "#"
End If
End If
'如果无选择项,则退出过程
If EmpetyAll Then
MsgBox "无选择条件!", vbInformation + vbOKOnly, "错误信息"
txtCount = 0
Exit Sub
End If
'完成统计动作
Set recPartyCount = Dbstudent.OpenRecordset(sqlForParty, dbOpenSnapshot)
If recPartyCount.RecordCount <> 0 Then
recPartyCount.MoveLast
txtCount = recPartyCount.RecordCount
Else
txtCount = 0
End If
End Sub
Private Sub Command1_Click()
On Error Resume Next
Unload Me
End Sub
Private Sub Form_Load()
On Error Resume Next
'frmPartyCount.Picture = LoadPicture(App.Path + "\PICTURE\SKY.BMP")
Line4.X1 = 0
Line4.X2 = frmPartyCount.Width
End Sub
Private Sub Form_Unload(Cancel As Integer)
On Error Resume Next
Unload Me
End Sub
Private Sub MNUEXIT_Click()
On Error Resume Next
Call cmdExit_Click
End Sub
Private Sub MNUHELP1_Click()
Dim TTT As String
Dim X
TTT = App.Path + "\help\djtj.txt"
X = Shell("Notepad " + TTT, 1)
End Sub
Private Sub MNUINPUT_Click()
On Error Resume Next
frmPartyInput.Show 1
End Sub
Private Sub mnurep_Click()
On Error Resume Next
frmPartyModify.Show 1
End Sub
Private Sub MNUSQU_Click()
On Error Resume Next
frmQueryParty.Show 1
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -