📄 memberedit.frm
字号:
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00FF0000&
Height = 240
Left = 840
TabIndex = 25
Top = 4490
Width = 960
End
Begin VB.Label Label6
AutoSize = -1 'True
Caption = "电话"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00FF0000&
Height = 240
Left = 1080
TabIndex = 24
Top = 3260
Width = 480
End
Begin VB.Label Label5
AutoSize = -1 'True
Caption = "电子邮件"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00FF0000&
Height = 240
Left = 840
TabIndex = 23
Top = 2720
Width = 960
End
Begin VB.Label Label4
AutoSize = -1 'True
Caption = "性别"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00FF0000&
Height = 240
Left = 1080
TabIndex = 22
Top = 2200
Width = 480
End
Begin VB.Label Label3
AutoSize = -1 'True
Caption = "年龄"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00FF0000&
Height = 240
Left = 1080
TabIndex = 21
Top = 1600
Width = 480
End
Begin VB.Label Label2
AutoSize = -1 'True
Caption = "姓名"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00FF0000&
Height = 240
Left = 1080
TabIndex = 20
Top = 1000
Width = 480
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "会员编号"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00FF0000&
Height = 240
Left = 840
TabIndex = 19
Top = 400
Width = 960
End
End
Begin VB.Frame Frame2
Height = 1695
Left = 240
TabIndex = 28
Top = 6360
Width = 6975
End
Begin VB.Label Label9
AutoSize = -1 'True
Caption = "会员信息修改"
BeginProperty Font
Name = "宋体"
Size = 15
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00FF00FF&
Height = 300
Left = 2520
TabIndex = 17
Top = 120
Width = 1800
End
End
Attribute VB_Name = "MemberEditer"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim com As Command
Dim rst As Recordset
Dim id As String
Private Sub CancelBT_Click()
'rst.Open
'rst.CancelUpdate
'rst.Close
Unload Me
End Sub
Private Sub ClearBT_Click()
For Each Control In MemberEdit
If TypeOf Control Is TextBox Then
If Control <> TID Then
Control.Text = ""
End If
End If
Next
End Sub
Private Sub First_Click()
rst.Open
rst.MoveFirst
DetailsShow
'Previours.Enabled = False
End Sub
Private Sub Form_Load()
Set com = New Command
Set rst = New Recordset
'On Error GoTo err
MsgBox id
If id = "" Then
'MsgBox "空"
On Error GoTo err
rst.Open "select * from member", con, adOpenDynamic, adLockBatchOptimistic
DetailsShow
Else
'MsgBox "id"
On Error GoTo err
rst.Open "select * from member where cmemberid = '" & id & "'", con, adOpenDynamic, adLockBatchOptimistic
DetailsShow
'rst.Close
End If
Exit Sub
err:
MsgBox "数据库没有连接!请连接!"
'VCDMS.Show
Unload Me
End Sub
Public Sub DetailsShow()
If rst.EOF Then
MsgBox "会员信息表为空!没有任何会员信息!"
rst.Close
Else
TID.Text = rst!cMemberID
Tname.Text = rst!cMemberName
TAge.Text = rst!cage
ComboSex.Text = rst!cSex
TEmail.Text = rst!cEmail
TPhone.Text = rst!cPhone
TCardnum.Text = rst!cCardnum
TAddress.Text = rst!cAddress
TPostcode.Text = rst!cPostcode
TMoney.Text = rst!mMoney
rst.Close
End If
End Sub
Private Sub Last_Click()
rst.Open
rst.MoveLast
DetailsShow
End Sub
Private Sub Next_Click()
rst.Open
rst.MoveNext
If rst.EOF = True Then
rst.MoveLast
End If
DetailsShow
End Sub
Private Sub Previours_Click()
rst.Open
rst.MovePrevious
If rst.BOF = True Then
rst.MoveFirst
End If
DetailsShow
End Sub
Private Sub SureBT_Click()
For Each Control In MemberEditer
If TypeOf Control Is TextBox Then
If Control <> TID Then
If Trim(Control.Text) = "" Then
MsgBox "请输入完整信息"
Exit Sub
End If
End If
End If
Next
If Len(Tname.Text) > 15 Then
MsgBox "姓名过长!请检查!"
Tname.SetFocus
Exit Sub
End If
If Asc(Trim(TAge.Text)) > 57 Or Asc(Trim(TAge.Text)) < 48 Then
MsgBox "您的年龄有问题!请输入数字!"
TAge.SetFocus
Exit Sub
ElseIf Len(Trim(TAge.Text)) > 3 Then
MsgBox "您的年龄有那么大嘛!请检查!"
TAge.SetFocus
Exit Sub
ElseIf Trim(TAge.Text) = 0 Then
MsgBox "0岁的您也能看电影嘛!"
TAge.SetFocus
Exit Sub
End If
If ComboSex.Text = "" Then
MsgBox "请选择您的性别!"
ComboSex.SetFocus
Exit Sub
End If
If Len(Trim(TEmail.Text)) > 30 Then
MsgBox "电子邮件过长!请检查!"
TEmail.SetFocus
Exit Sub
End If
If MemberRE.checkemail(TEmail.Text) = 0 Then
MsgBox "电子邮件输入有误!请检查!"
TEmail.SetFocus
Exit Sub
End If
If Asc(Trim(TPhone.Text)) > 57 Or Asc(Trim(TPhone.Text)) < 48 Then
MsgBox "电话号码有误!请输入数字!"
TPhone.SetFocus
Exit Sub
ElseIf Len(Trim(TPhone.Text)) > 13 Or Len(Trim(TPhone.Text)) < 8 Then
MsgBox "电话号码有误!请检查!"
TPhone.SetFocus
Exit Sub
End If
If Asc(Trim(TCardnum.Text)) > 57 Or Asc(Trim(TCardnum.Text)) < 48 Then
MsgBox "身份证号码有误!请输入数字!"
TCardnum.SetFocus
Exit Sub
ElseIf Len(Trim(TCardnum.Text)) > 18 Or Len(Trim(TCardnum.Text)) < 15 Then
MsgBox "身份证号码有误!请检查!"
TCardnum.SetFocus
Exit Sub
End If
If Asc(Trim(TPostcode.Text)) > 57 Or Asc(Trim(TPostcode.Text)) < 48 Then
MsgBox "邮政编码有误!请输入数字!"
TPostcode.SetFocus
Exit Sub
ElseIf Len(Trim(TPostcode.Text)) > 6 Then
MsgBox "邮编过长!请检查!"
TPostcode.SetFocus
Exit Sub
End If
Dim id, name, money, age, sex, email, address, postcode, phone, cardnum As String
id = TID.Text
name = Tname.Text
age = TAge.Text
sex = ComboSex.Text
email = TEmail.Text
address = TAddress.Text
postcode = TPostcode.Text
phone = TPhone.Text
cardnum = TCardnum.Text
money = TMoney.Text
'On Error GoTo err
'com.ActiveConnection = con
rst.Open "update Member set cmembername='" & name & "',mMoney=" & money & ",cage='" & age & "',csex='" & sex & "',cemail='" & email & "',caddress='" & _
address & "',cpostcode='" & postcode & "',cphone='" & phone & "',ccardnum='" & cardnum & "' where cmemberid= " & id & "", con, adOpenDynamic, adLockOptimistic
MsgBox "您的信息修改成功!:)"
'rst.Close
Unload Me
Exit Sub
err:
MsgBox "请确认数据库是否连接!"
End Sub
Public Function ReceiveID(receid As String)
id = receid
MsgBox id
End Function
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -