📄 v6bj11-12c.frm
字号:
VERSION 5.00
Begin VB.Form Form11
Caption = "VB6 例11-12c 用DAO查找数据"
ClientHeight = 1830
ClientLeft = 60
ClientTop = 345
ClientWidth = 4980
LinkTopic = "Form1"
ScaleHeight = 1830
ScaleWidth = 4980
StartUpPosition = 3 '窗口缺省
Begin VB.Data Data1
Align = 2 'Align Bottom
Caption = "基本情况"
Connect = "Access"
DatabaseName = "Student.mdb"
DefaultCursorType= 0 '缺省游标
DefaultType = 2 '使用 ODBC
Exclusive = 0 'False
Height = 345
Left = 0
Options = 0
ReadOnly = 0 'False
RecordsetType = 0 'Table
RecordSource = "基本情况"
Top = 1485
Width = 4980
End
Begin VB.PictureBox Picture1
AutoSize = -1 'True
DataField = "照片"
DataSource = "Data1"
Height = 855
Left = 120
ScaleHeight = 795
ScaleWidth = 675
TabIndex = 6
Top = 60
Width = 735
End
Begin VB.TextBox Text3
DataField = "性别"
DataSource = "Data1"
Height = 375
Left = 4440
TabIndex = 5
Top = 60
Width = 375
End
Begin VB.TextBox Text5
DataField = "出生年月"
DataSource = "Data1"
Height = 375
Left = 3660
TabIndex = 4
Top = 540
Width = 1215
End
Begin VB.TextBox Text4
DataField = "专业"
DataSource = "Data1"
Height = 375
Left = 1440
TabIndex = 3
Top = 540
Width = 1335
End
Begin VB.TextBox Text2
DataField = "姓名"
DataSource = "Data1"
Height = 375
Left = 2760
TabIndex = 2
Top = 60
Width = 1215
End
Begin VB.TextBox Text1
DataField = "学号"
DataSource = "Data1"
Height = 375
Left = 1440
TabIndex = 1
Top = 60
Width = 855
End
Begin VB.CommandButton Command5
Caption = "查找"
Height = 315
Left = 3720
TabIndex = 0
Top = 1020
Width = 795
End
Begin VB.Label Label1
Caption = "学号"
Height = 255
Index = 0
Left = 960
TabIndex = 11
Top = 180
Width = 495
End
Begin VB.Label Label1
Caption = "性别"
Height = 255
Index = 4
Left = 4050
TabIndex = 10
Top = 180
Width = 405
End
Begin VB.Label Label1
Caption = "年龄"
Height = 255
Index = 3
Left = 3060
TabIndex = 9
Top = 600
Width = 495
End
Begin VB.Label Label1
Caption = "专业"
Height = 255
Index = 2
Left = 960
TabIndex = 8
Top = 660
Width = 495
End
Begin VB.Label Label1
Caption = "姓名"
Height = 255
Index = 1
Left = 2340
TabIndex = 7
Top = 180
Width = 495
End
End
Attribute VB_Name = "Form11"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command5_Click()
Dim mzy As String
Dim db As Database, rs As Recordset, mpath As String
mpath = App.Path
If Right(mpath, 1) <> "\" Then mpath = mpath + "\"
Set db = OpenDatabase(mpath + "Student.mdb")
Set rs = db.OpenRecordset("基本情况")
mzy = InputBox$("请输入专业", "查找窗")
rs.FindFirst "专业='" & mzy & "'"
If Data1.Recordset.EOF Then
MsgBox "无此专业!", , "提示"
Data1.RecordSource = "基本情况"
Data1.Refresh
End If
End Sub
Private Sub Form_Load()
mpath = App.Path
If Right(mpath, 1) <> "\" Then mpath = mpath + "\"
Data1.DatabaseName = mpath + "student.mdb"
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -