exam8-6-1.frm
来自「vb数据库编程资料」· FRM 代码 · 共 579 行 · 第 1/2 页
FRM
579 行
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 Command15_Click()
Data1.Recordset.AddNew
Command15.Enabled = False
Command16.Enabled = False
Command17.Enabled = True
Command18.Enabled = True
End Sub
Private Sub Command16_Click()
Data1.Recordset.Edit
Command15.Enabled = False
Command16.Enabled = False
Command17.Enabled = True
Command18.Enabled = True
End Sub
Private Sub Command17_Click()
Data1.Recordset.Update
Command15.Enabled = True
Command16.Enabled = True
Command17.Enabled = False
Command18.Enabled = False
End Sub
Private Sub Command18_Click()
Data1.Refresh
Command15.Enabled = True
Command16.Enabled = True
Command17.Enabled = False
Command18.Enabled = False
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
Private Sub Data1_Validate(Action As Integer, Save As Integer)
Dim xm As String
If Save Then
xm = Trim(Text2.Text)
If Len(xm) = 0 Then
MsgBox ("教师姓名必须输入")
Action = 0
End If
End If
End Sub
Private Sub Form_Load()
Command15.Enabled = True
Command16.Enabled = True
Command17.Enabled = False
Command18.Enabled = False
End Sub
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?