📄 frmms.frm
字号:
VERSION 5.00
Begin VB.Form frmms
BackColor = &H00000000&
Caption = "Search for Members"
ClientHeight = 7260
ClientLeft = 60
ClientTop = 450
ClientWidth = 4590
Icon = "frmms.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 7260
ScaleWidth = 4590
StartUpPosition = 3 'Windows Default
Begin VB.CommandButton cmdexit
Caption = "&C a n c e l"
Height = 495
Left = 240
TabIndex = 20
Top = 6480
Width = 4095
End
Begin VB.TextBox txtsearchname
Height = 375
Left = 1080
TabIndex = 19
Top = 1080
Width = 1575
End
Begin VB.CommandButton cmdclear
Caption = "&Clear"
Height = 375
Left = 3000
TabIndex = 17
Top = 1080
Width = 735
End
Begin VB.Frame Frame1
BackColor = &H00000000&
Caption = "Search by:"
ForeColor = &H00FFFFFF&
Height = 1575
Left = 240
TabIndex = 11
Top = 240
Width = 4095
Begin VB.TextBox Txtsearchid
Height = 375
Left = 840
TabIndex = 13
Top = 360
Width = 1575
End
Begin VB.CommandButton cmdsearch
Caption = "&Search"
Height = 375
Left = 2760
TabIndex = 12
Top = 360
Width = 735
End
Begin VB.Label lblsearchname
BackColor = &H00FFC0C0&
BackStyle = 0 'Transparent
Caption = "Name:"
ForeColor = &H00FFFFFF&
Height = 375
Left = 240
TabIndex = 18
Top = 840
Width = 495
End
Begin VB.Label lblsearchid
BackColor = &H00FFC0C0&
BackStyle = 0 'Transparent
Caption = "ID: "
ForeColor = &H00FFFFFF&
Height = 375
Left = 240
TabIndex = 14
Top = 480
Width = 855
End
End
Begin VB.Frame Frame2
BackColor = &H00000000&
Caption = "Members Details:"
ForeColor = &H00FFFFFF&
Height = 4215
Left = 240
TabIndex = 0
Top = 2040
Width = 4095
Begin VB.TextBox txtdob
Height = 375
Left = 1320
TabIndex = 16
Top = 2280
Width = 2535
End
Begin VB.TextBox txtname
Height = 375
Left = 1320
TabIndex = 6
Top = 480
Width = 2535
End
Begin VB.TextBox txtid
Enabled = 0 'False
Height = 375
Left = 1320
TabIndex = 5
Top = 960
Width = 2535
End
Begin VB.TextBox txtadd
Height = 735
Left = 1320
MultiLine = -1 'True
TabIndex = 4
Top = 1440
Width = 2535
End
Begin VB.TextBox txtphone
Height = 375
Left = 1320
TabIndex = 3
Top = 2760
Width = 2535
End
Begin VB.CommandButton cmdedit
Caption = "&Edit"
Height = 615
Left = 240
TabIndex = 2
Top = 3360
Width = 1695
End
Begin VB.CommandButton cmddel
Caption = "&Delete"
Height = 615
Left = 2160
TabIndex = 1
Top = 3360
Width = 1695
End
Begin VB.Label lbldob
BackColor = &H00FFC0C0&
BackStyle = 0 'Transparent
Caption = "D.O.B."
ForeColor = &H00FFFFFF&
Height = 375
Left = 240
TabIndex = 15
Top = 2280
Width = 975
End
Begin VB.Label lblname
BackColor = &H00FFC0C0&
BackStyle = 0 'Transparent
Caption = "Name:"
ForeColor = &H00FFFFFF&
Height = 375
Left = 240
TabIndex = 10
Top = 480
Width = 1215
End
Begin VB.Label lblid
BackColor = &H00FFC0C0&
BackStyle = 0 'Transparent
Caption = "ID:"
ForeColor = &H00FFFFFF&
Height = 375
Left = 240
TabIndex = 9
Top = 960
Width = 1095
End
Begin VB.Label lbladd
BackColor = &H00FFC0C0&
BackStyle = 0 'Transparent
Caption = "Address:"
ForeColor = &H00FFFFFF&
Height = 375
Left = 240
TabIndex = 8
Top = 1440
Width = 1095
End
Begin VB.Label lblphone
BackColor = &H00FFC0C0&
BackStyle = 0 'Transparent
Caption = "Phone:"
ForeColor = &H00FFFFFF&
Height = 495
Left = 240
TabIndex = 7
Top = 2880
Width = 975
End
End
Begin VB.Data Data1
Caption = "Data1"
Connect = "Access"
DatabaseName = ""
DefaultCursorType= 0 'DefaultCursor
DefaultType = 2 'UseODBC
Exclusive = 0 'False
Height = 345
Left = 240
Options = 0
ReadOnly = 0 'False
RecordsetType = 1 'Dynaset
RecordSource = ""
Top = 2040
Visible = 0 'False
Width = 4020
End
End
Attribute VB_Name = "frmms"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub cmdclear_Click()
txtsearchname.Text = ""
Txtsearchid.Text = ""
txtsearchname.SetFocus
End Sub
Private Sub cmddel_Click()
If txtname <> "" Then
If MsgBox("Confirm to Delete the data?", vbYesNo) = vbYes Then
With Data1.Recordset
.FindFirst ("id='" & txtid & "'")
If .NoMatch = False Then
.Delete
Call clearinfo
MsgBox "Data Deleted!", vbInformation
Else
MsgBox "No such record to delete!", vbInformation
Call clearinfo
End If
End With
Data1.Refresh
End If
Else
MsgBox "Please select a record to delete!", vbInformation
End If
End Sub
Private Sub cmdedit_Click()
If txtname.Text <> "" Then
If MsgBox("Confirm to Edit the data?", vbYesNo) = vbYes Then
With Data1.Recordset
.FindFirst ("id='" & txtid & "'")
If .NoMatch = False Then
.Edit
!Name = txtname.Text
!id = txtid.Text
!Address = txtadd.Text
!dob = txtdob.Text
!Phone = txtphone.Text
.Update
Call clearinfo
MsgBox "Data Edited!", vbInformation
End If
End With
Data1.Refresh
End If
Else
MsgBox "Please select a record to edit!", vbInformation
End If
End Sub
Private Sub cmdexit_Click()
Unload Me
End Sub
Private Sub cmdsearch_Click()
If txtsearchname.Text = "" And Txtsearchid.Text = "" Then
MsgBox "Please input on one of the textbox", vbInformation
txtsearchname.SetFocus
ElseIf txtsearchname.Text <> "" And Txtsearchid.Text <> "" Then
MsgBox "Please input only on one textbox", vbInformation
txtsearchname.Text = ""
Txtsearchid.Text = ""
txtsearchname.SetFocus
ElseIf txtsearchname.Text <> "" Then
Call searchname
Else
Call searchid
End If
End Sub
Private Sub searchname()
With Data1.Recordset
.FindFirst ("name='" & txtsearchname & "'")
If .NoMatch = False Then
Call displayinfo
Else
MsgBox "No record found!!!", vbInformation
txtsearchname.Text = ""
Txtsearchid.Text = ""
txtsearchname.SetFocus
End If
End With
End Sub
Private Sub searchid()
With Data1.Recordset
.FindFirst ("ID='" & Txtsearchid & "'")
If .NoMatch = False Then
Call displayinfo
Else
MsgBox "No record found!!!", vbInformation
txtsearchname.Text = ""
Txtsearchid.Text = ""
txtsearchname.SetFocus
End If
End With
End Sub
Private Sub displayinfo()
With Data1.Recordset
txtname = !Name
txtid = !id
txtadd = !Address
txtdob = !dob
txtphone = !Phone
End With
End Sub
Private Sub Form_Load()
Data1.DatabaseName = App.Path & "/video.mdb"
Data1.RecordSource = "SELECT * FROM member"
txtid.Enabled = False
End Sub
Private Sub txtsearchname_KeyPress(KeyAscii As Integer)
If KeyAscii = vbKeyReturn Then
Call searchname
End If
End Sub
Private Sub txtsearchid_KeyPress(KeyAscii As Integer)
If KeyAscii = vbKeyReturn Then
Call searchid
End If
End Sub
Private Sub clearinfo()
txtname.Text = ""
txtid.Text = ""
txtphone.Text = ""
txtadd.Text = ""
txtdob.Text = ""
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -