📄 exam8-4-1.frm
字号:
VERSION 5.00
Begin VB.Form Form1
Caption = "Form1"
ClientHeight = 5385
ClientLeft = 60
ClientTop = 450
ClientWidth = 6015
LinkTopic = "Form1"
ScaleHeight = 5385
ScaleWidth = 6015
StartUpPosition = 3 '窗口缺省
Begin VB.Frame Frame3
Caption = "按学号索引查找"
Height = 735
Left = 240
TabIndex = 34
Top = 4560
Width = 5655
Begin VB.CommandButton Command14
Caption = "查找"
Height = 375
Left = 2160
TabIndex = 37
Top = 240
Width = 975
End
Begin VB.TextBox Text11
Height = 375
Left = 720
TabIndex = 36
Top = 240
Width = 1095
End
Begin VB.Label Label10
Caption = "学号:"
Height = 375
Left = 120
TabIndex = 35
Top = 240
Width = 615
End
End
Begin VB.Frame Frame2
Caption = "按姓名模糊查找"
Height = 735
Left = 240
TabIndex = 27
Top = 3720
Width = 5535
Begin VB.CommandButton Command13
Caption = "最后一个"
Height = 375
Left = 4560
TabIndex = 33
Top = 240
Width = 855
End
Begin VB.CommandButton Command12
Caption = "上一个"
Height = 375
Left = 3600
TabIndex = 32
Top = 240
Width = 855
End
Begin VB.CommandButton Command11
Caption = "下一个"
Height = 375
Left = 2640
TabIndex = 31
Top = 240
Width = 855
End
Begin VB.CommandButton Command10
Caption = "第一个"
Height = 375
Left = 1680
TabIndex = 30
Top = 240
Width = 855
End
Begin VB.TextBox Text10
Height = 375
Left = 720
TabIndex = 29
Top = 240
Width = 855
End
Begin VB.Label Label9
Caption = "姓名:"
Height = 375
Left = 120
TabIndex = 28
Top = 240
Width = 615
End
End
Begin VB.Frame Frame1
Caption = "按姓名精确查找"
Height = 735
Left = 240
TabIndex = 20
Top = 2880
Width = 5535
Begin VB.TextBox Text9
Height = 375
Left = 720
TabIndex = 26
Top = 240
Width = 975
End
Begin VB.CommandButton Command9
Caption = "最后一个"
Height = 375
Left = 4560
TabIndex = 24
Top = 240
Width = 855
End
Begin VB.CommandButton Command8
Caption = "上一个"
Height = 375
Left = 3600
TabIndex = 23
Top = 240
Width = 855
End
Begin VB.CommandButton Command7
Caption = "下一个"
Height = 375
Left = 2640
TabIndex = 22
Top = 240
Width = 855
End
Begin VB.CommandButton Command6
Caption = "第一个"
Height = 375
Left = 1680
TabIndex = 21
Top = 240
Width = 855
End
Begin VB.Label Label8
Caption = "姓名:"
Height = 375
Left = 120
TabIndex = 25
Top = 240
Width = 615
End
End
Begin VB.TextBox Text8
Height = 375
Left = 5040
TabIndex = 19
Top = 2400
Width = 735
End
Begin VB.CommandButton Command5
Caption = "移动记录数"
Height = 375
Left = 3840
TabIndex = 18
Top = 2400
Width = 1095
End
Begin VB.CommandButton Command4
Caption = "末记录"
Height = 375
Left = 2880
TabIndex = 17
Top = 2400
Width = 855
End
Begin VB.CommandButton Command3
Caption = "后移"
Height = 375
Left = 2040
TabIndex = 16
Top = 2400
Width = 735
End
Begin VB.CommandButton Command2
Caption = "前移"
Height = 375
Left = 1200
TabIndex = 15
Top = 2400
Width = 735
End
Begin VB.CommandButton Command1
Caption = "首记录"
Height = 375
Left = 120
TabIndex = 14
Top = 2400
Width = 975
End
Begin VB.TextBox Text7
DataField = "工资"
DataSource = "Data1"
Height = 375
Left = 1200
TabIndex = 13
Text = "Text7"
Top = 1920
Width = 975
End
Begin VB.TextBox Text6
DataField = "单位"
DataSource = "Data1"
Height = 375
Left = 3600
TabIndex = 10
Text = "Text6"
Top = 1440
Width = 1695
End
Begin VB.TextBox Text5
DataField = "职称"
DataSource = "Data1"
Height = 375
Left = 1200
TabIndex = 8
Text = "Text5"
Top = 1440
Width = 975
End
Begin VB.TextBox Text4
DataField = "出年日期"
DataSource = "Data1"
Height = 375
Left = 3720
TabIndex = 6
Text = "Text4"
Top = 840
Width = 975
End
Begin VB.TextBox Text3
DataField = "性别"
DataSource = "Data1"
Height = 375
Left = 1200
TabIndex = 5
Text = "Text3"
Top = 840
Width = 735
End
Begin VB.TextBox Text2
DataField = "姓名"
DataSource = "Data1"
Height = 375
Left = 3720
TabIndex = 2
Text = "Text2"
Top = 240
Width = 975
End
Begin VB.TextBox Text1
DataField = "教师编号"
DataSource = "Data1"
Height = 375
Left = 1200
TabIndex = 0
Text = "Text1"
Top = 240
Width = 1215
End
Begin VB.Data Data1
Caption = "Data1"
Connect = "Access"
DatabaseName = "C:\Documents and Settings\tongaihong\桌面\VB数据库程序与数据\08\教学.mdb"
DefaultCursorType= 0 '缺省游标
DefaultType = 2 '使用 ODBC
Exclusive = 0 'False
Height = 375
Left = 2640
Options = 0
ReadOnly = 0 'False
RecordsetType = 0 'Table
RecordSource = "教师表"
Top = 1920
Visible = 0 'False
Width = 2775
End
Begin VB.Label Label7
Caption = "工资:"
Height = 375
Left = 120
TabIndex = 12
Top = 1920
Width = 855
End
Begin VB.Label Label6
Caption = "单位:"
Height = 375
Left = 2760
TabIndex = 11
Top = 1440
Width = 735
End
Begin VB.Label Label5
Caption = "职称:"
Height = 375
Left = 120
TabIndex = 9
Top = 1440
Width = 735
End
Begin VB.Label Label4
Caption = "出生日期:"
Height = 375
Left = 2760
TabIndex = 7
Top = 840
Width = 975
End
Begin VB.Label Label3
Caption = "性别:"
Height = 375
Left = 120
TabIndex = 4
Top = 840
Width = 975
End
Begin VB.Label Label2
Caption = "姓名:"
Height = 255
Left = 2880
TabIndex = 3
Top = 240
Width = 735
End
Begin VB.Label Label1
Caption = "教师编号:"
Height = 375
Left = 120
TabIndex = 1
Top = 240
Width = 975
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
Data1.Recordset.MoveFirst
Command1.Enabled = False
Command2.Enabled = False
Command3.Enabled = True
Command4.Enabled = True
End Sub
Private Sub Command10_Click()
Dim BM
BM = Data1.Recordset.Bookmark
Data1.Recordset.FindFirst "姓名 Like " & "'*" & Text10.Text & "*'"
If Data1.Recordset.NoMatch Then
MsgBox ("没有符合条件的记录")
Data1.Recordset.Bookmark = BM
End If
End Sub
Private Sub Command11_Click()
Dim BM
BM = Data1.Recordset.Bookmark
Data1.Recordset.FindNext "姓名 Like " & "'*" & Text10.Text & "*'"
If Data1.Recordset.NoMatch Then
MsgBox ("没有符合条件的记录")
Data1.Recordset.Bookmark = BM
End If
End Sub
Private Sub Command12_Click()
Dim BM
BM = Data1.Recordset.Bookmark
Data1.Recordset.FindPrevious "姓名 Like " & "'*" & Text10.Text & "*'"
If Data1.Recordset.NoMatch Then
MsgBox ("没有符合条件的记录")
Data1.Recordset.Bookmark = BM
End If
End Sub
Private Sub Command13_Click()
Dim BM
BM = Data1.Recordset.Bookmark
Data1.Recordset.FindLast "姓名 Like " & "'*" & Text10.Text & "*'"
If Data1.Recordset.NoMatch Then
MsgBox ("没有符合条件的记录")
Data1.Recordset.Bookmark = BM
End If
End Sub
Private Sub Command14_Click()
Dim BM
If Data1.Recordset.RecordCount > 0 Then
BM = Data1.Recordset.Bookmark
End If
Data1.Recordset.Index = "PrimaryKey"
Data1.Recordset.Seek "=", Text11.Text
If Data1.Recordset.NoMatch Then
MsgBox ("没有该教师号的教师")
Data1.Recordset.Bookmark = BM
End If
End Sub
Private Sub Command2_Click()
Data1.Recordset.MovePrevious
Command3.Enabled = True
Command4.Enabled = True
If Data1.Recordset.BOF Then
Data1.Recordset.MoveFirst
Command1.Enabled = False
Command2.Enabled = False
End If
End Sub
Private Sub Command3_Click()
Data1.Recordset.MoveNext
Command1.Enabled = True
Command2.Enabled = True
If Data1.Recordset.EOF Then
Data1.Recordset.MoveFirst
Command3.Enabled = False
Command4.Enabled = False
End If
End Sub
Private Sub Command4_Click()
Data1.Recordset.MoveLast
Command1.Enabled = True
Command2.Enabled = True
Command3.Enabled = False
Command4.Enabled = False
End Sub
Private Sub Command5_Click()
Dim N As Integer
N = Val(Text8.Text)
Data1.Recordset.Move N
End Sub
Private Sub Command6_Click()
Dim BM
BM = Data1.Recordset.Bookmark
Data1.Recordset.FindFirst "姓名=" & "'" & Text9.Text & "'"
If Data1.Recordset.NoMatch Then
MsgBox ("没有符合条件的记录")
Data1.Recordset.Bookmark = BM
End If
End Sub
Private Sub Command7_Click()
Dim BM
BM = Data1.Recordset.Bookmark
Data1.Recordset.FindNext "姓名=" & "'" & Text9.Text & "'"
If Data1.Recordset.NoMatch Then
MsgBox ("没有符合条件的记录")
Data1.Recordset.Bookmark = BM
End If
End Sub
Private Sub Command8_Click()
Dim BM
BM = Data1.Recordset.Bookmark
Data1.Recordset.FindPrevious "姓名=" & "'" & Text9.Text & "'"
If Data1.Recordset.NoMatch Then
MsgBox ("没有符合条件的记录")
Data1.Recordset.Bookmark = BM
End If
End Sub
Private Sub Command9_Click()
Dim BM
BM = Data1.Recordset.Bookmark
Data1.Recordset.FindLast "姓名=" & "'" & Text9.Text & "'"
If Data1.Recordset.NoMatch Then
MsgBox ("没有符合条件的记录")
Data1.Recordset.Bookmark = BM
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -