?? 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 + -