?? frmfindstu.frm
字號:
VERSION 5.00
Begin VB.Form frmFindStu
Caption = "查找"
ClientHeight = 1695
ClientLeft = 6090
ClientTop = 3630
ClientWidth = 4215
BeginProperty Font
Name = "宋體"
Size = 9
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Icon = "frmFindStu.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 1695
ScaleWidth = 4215
Begin VB.CommandButton cmdCancel
Caption = "取 消"
Height = 375
Left = 2520
TabIndex = 4
Top = 1200
Width = 975
End
Begin VB.CommandButton cmdFind
Caption = "查 找"
Height = 375
Left = 1080
TabIndex = 3
Top = 1200
Width = 975
End
Begin VB.Frame fraFind
Caption = "查找"
Height = 855
Left = 120
TabIndex = 0
Top = 120
Width = 4095
Begin VB.CheckBox chkOnlyNum
Caption = "Check1"
Height = 255
Left = 240
TabIndex = 5
Top = 360
Visible = 0 'False
Width = 255
End
Begin VB.TextBox txtFindName
Height = 375
Left = 1800
TabIndex = 2
Top = 960
Width = 2295
End
Begin VB.TextBox txtFindNum
Height = 390
Left = 1560
TabIndex = 1
Top = 270
Width = 2295
End
Begin VB.Label labFindNum
Caption = "學生學號"
Height = 255
Left = 360
TabIndex = 7
Top = 360
Width = 855
End
Begin VB.Label labFindName
Caption = "學生姓名"
Height = 255
Left = 720
TabIndex = 6
Top = 1080
Width = 855
End
End
End
Attribute VB_Name = "frmFindStu"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private Sub cmdFind_Click()
If Trim(txtFindNum.Text) = "" Then
MsgBox ("請重新輸入!")
End If
If Trim(txtFindNum.Text) <> "" Then
Select Case SeltFrom
Case 1
Call FindStuIfm
Case 2
Call FindMdfiScore
Case 3
Call FindStuPlace
End Select
'frmStuIfm.Show
Load frmMdfiScore
'frmMdfiScore.Show
'Unload login
mCnnString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\StuScore.mdb" & ";Persist Security Info=False"
'MDIfrmMain.Show
End If
End Sub
Private Sub cmdCancel_Click()
Unload Me
End Sub
'查找學生資料記錄,若checkbox打鉤則只按學生學號查找
Private Sub FindStuIfm()
On Error GoTo mErr
Dim mRst As New ADODB.Recordset
Dim mLItem As ListItem
Dim mStrSend As String
frmStuIfm.lsvStuIfm.ListItems.Clear
mStrSend = ""
Call FindStr(mStrSend)
mRst.Open "SELECT * FROM tblStudent WHERE " & mStrSend, mCnnString, adOpenKeyset, adLockPessimistic, adCmdText
Do Until mRst.EOF
Set mLItem = frmStuIfm.lsvStuIfm.ListItems.Add(, , mRst("學生學號"))
With mLItem
.SubItems(1) = mRst("學生姓名")
.SubItems(2) = mRst("性別")
.SubItems(3) = Format(mRst("入學日期"), "yyyy年mm月dd日")
.Tag = mRst("學生ID")
.SubItems(4) = mRst("班級")
.SubItems(5) = mRst("院系")
End With
mRst.MoveNext
Loop
mRst.Close
Set mRst = Nothing
Exit Sub
mErr:
MsgBox Err.Number & "," & Err.Description, vbCritical + vbOKOnly, mTitle
End
End Sub
'查找學生的成績,若tblStudent表中有該學生但tblScore表中卻無他的成績,則顯示零值
Private Sub FindMdfiScore()
On Error GoTo mErr
Dim mStrSend As String
mStrSend = ""
Call FindStr(mStrSend)
Call frmMdfiScore.DataToList("SELECT * FROM tblStudent WHERE " & mStrSend)
Exit Sub
mErr:
MsgBox Err.Number & "," & Err.Description, vbCritical + vbOKOnly, mTitle
End
End Sub
'查找學生成績記錄以及名次,若checkbox打鉤,則只按學生學號尋找,找到后把它的各科成績、總分、平均分、名次顯示在列表中
Private Sub FindStuPlace()
On Error GoTo mErr
Dim mStrSend As String
mStrSend = ""
Call FindStr(mStrSend)
frmStuPlace.lsvStuPlace.ListItems.Clear
Call frmStuPlace.DataToList("SELECT * FROM tblStudent WHERE " & mStrSend)
Exit Sub
mErr:
MsgBox Err.Number & "," & Err.Description, vbCritical + vbOKOnly, mTitle
End
End Sub
'對查找條件加工成SQL語句的一部分
Private Sub FindStr(mStr As String)
mStr = "學生學號 LIKE '%" & Trim(txtFindNum.Text) & "%'"
If chkOnlyNum = 0 And Trim(txtFindName.Text) <> "" Then
mStr = mStr & " AND 學生姓名 LIKE '%" & Trim(txtFindName.Text) & "%'"
End If
End Sub
Private Sub Form_Load()
mCnnString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\StuScore.mdb" & ";Persist Security Info=False"
'MDIfrmMain.Show
End Sub
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -