📄 frmmemberedit.frm
字号:
VERSION 5.00
Begin VB.Form frmMemberEdit
Caption = "会员资料修改"
ClientHeight = 6135
ClientLeft = 60
ClientTop = 450
ClientWidth = 4815
LinkTopic = "Form1"
ScaleHeight = 6135
ScaleWidth = 4815
StartUpPosition = 2 'CenterScreen
Visible = 0 'False
Begin VB.CommandButton cmdBack
Caption = "返 回"
Height = 495
Left = 3360
TabIndex = 12
Top = 5160
Width = 1335
End
Begin VB.TextBox txtId
Height = 405
Left = 1800
Locked = -1 'True
TabIndex = 11
Top = 360
Width = 2055
End
Begin VB.CommandButton cmdRewrite
Caption = "重 填"
Height = 495
Left = 1800
TabIndex = 5
Top = 5160
Width = 1335
End
Begin VB.CommandButton cmdCheck
Caption = "提 交"
Height = 495
Left = 240
TabIndex = 4
Top = 5160
Width = 1335
End
Begin VB.TextBox txtPersonID
BeginProperty Font
Name = "MS Sans Serif"
Size = 12
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 420
Left = 1800
TabIndex = 3
Top = 2280
Width = 2055
End
Begin VB.TextBox txtName
BeginProperty Font
Name = "MS Sans Serif"
Size = 12
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 405
Left = 1800
TabIndex = 2
Top = 1320
Width = 2055
End
Begin VB.TextBox txtAddress
BeginProperty Font
Name = "MS Sans Serif"
Size = 12
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 405
Left = 1800
TabIndex = 1
Top = 4200
Width = 2055
End
Begin VB.TextBox txtTel
BeginProperty Font
Name = "MS Sans Serif"
Size = 12
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 420
Left = 1800
TabIndex = 0
Top = 3240
Width = 2055
End
Begin VB.Label Label5
Caption = "会员编号:"
BeginProperty Font
Name = "MS Sans Serif"
Size = 12
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 360
TabIndex = 10
Top = 480
Width = 1335
End
Begin VB.Label Label2
Caption = "身份证号:"
BeginProperty Font
Name = "MS Sans Serif"
Size = 12
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 360
TabIndex = 9
Top = 2280
Width = 1335
End
Begin VB.Label Label1
Caption = "姓名:"
BeginProperty Font
Name = "MS Sans Serif"
Size = 12
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 840
TabIndex = 8
Top = 1320
Width = 735
End
Begin VB.Label Label3
Caption = "电话号码:"
BeginProperty Font
Name = "MS Sans Serif"
Size = 12
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 360
TabIndex = 7
Top = 3240
Width = 1215
End
Begin VB.Label Label4
Caption = "地址:"
BeginProperty Font
Name = "MS Sans Serif"
Size = 12
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 720
TabIndex = 6
Top = 4200
Width = 735
End
End
Attribute VB_Name = "frmMemberEdit"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub cmdBack_Click()
Unload Me
frmAdmin.Show
End Sub
Private Sub cmdCheck_Click()
If txtName Like "" Then
MsgBox "对不起,姓名不能为空!", vbOKOnly + vbExclamation, "错误"
txtName.SetFocus
Exit Sub
End If
If txtPersonID Like "" Then
MsgBox "对不起,身份证号码不能为空!", vbOKOnly + vbExclamation, "错误"
txtPersonID.SetFocus
Exit Sub
End If
Dim length As Integer
length = Len(txtPersonID.Text)
If length <> 18 Then
MsgBox "对不起,身份证号码错误!", vbOKOnly + vbExclamation, "错误"
txtPersonID.Text = ""
txtPersonID.SetFocus
Exit Sub
End If
For i = 1 To 18
If Mid(txtPersonID.Text, i, 1) < "0" Or Mid(txtPersonID.Text, i, 1) > "9" Then
MsgBox "对不起,身份证号码错误!", vbOKOnly + vbExclamation, "错误"
txtPersonID.Text = ""
txtPersonID.SetFocus
Exit Sub
End If
Next i
Set db = OpenDatabase("Haiyu.mdb")
Set rs = db.OpenRecordset("SELECT * FROM Customer")
rs.MoveFirst
Do Until rs.EOF
If rs!ID = Val(txtId.Text) Then
With rs
.Edit
!姓名 = txtName.Text
!身份证号 = txtPersonID.Text
!密码 = "111111"
!电话 = txtTel.Text
!地址 = txtAddress.Text
.Update
End With
MsgBox "会员" & txtId.Text & "的资料修改成功!", vbOKOnly, "成功"
Unload Me
frmAdmin.Show
Exit Sub
Else
rs.MoveNext
End If
Loop
End Sub
Private Sub cmdRewrite_Click()
txtName.Text = ""
txtPersonID.Text = ""
txtTel.Text = ""
txtAddress.Text = ""
End Sub
Private Sub Form_Load()
Set db = OpenDatabase("Haiyu.mdb")
Set rs = db.OpenRecordset("SELECT * FROM Customer")
rs.MoveFirst
Do Until rs.EOF
If rs!ID = tp Then
txtId.Text = tp
txtPersonID.Text = rs!身份证号
txtTel.Text = rs!电话
txtAddress.Text = rs!地址
txtName.Text = rs!姓名
Exit Sub
Else
rs.MoveNext
End If
Loop
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -