📄 addmember.frm
字号:
VERSION 5.00
Begin VB.Form addmember
BorderStyle = 1 'Fixed Single
Caption = "添加会员"
ClientHeight = 5235
ClientLeft = 45
ClientTop = 330
ClientWidth = 7080
LinkTopic = "Form1"
MaxButton = 0 'False
MDIChild = -1 'True
ScaleHeight = 5235
ScaleWidth = 7080
Begin VB.Timer Timer1
Interval = 1000
Left = 120
Top = 4560
End
Begin VB.OptionButton negetiveState
Caption = "停止"
Height = 180
Left = 3840
TabIndex = 21
Top = 2400
Width = 1455
End
Begin VB.OptionButton activeState
Caption = "活动"
Height = 180
Left = 3840
TabIndex = 20
Top = 2160
Width = 1455
End
Begin VB.TextBox memberMoney
Height = 375
Left = 3840
TabIndex = 19
Top = 1560
Width = 1335
End
Begin VB.TextBox memberDeposit
Height = 375
Left = 3840
TabIndex = 18
Top = 960
Width = 1335
End
Begin VB.TextBox memberAddress
Height = 375
Left = 3840
TabIndex = 17
Top = 360
Width = 3015
End
Begin VB.TextBox memberPhone
Height = 375
Left = 840
TabIndex = 16
Top = 2760
Width = 1695
End
Begin VB.CommandButton CancleSign
Caption = "取消"
Height = 615
Left = 4800
TabIndex = 15
Top = 4320
Width = 1215
End
Begin VB.CommandButton SignIn
Caption = "添加"
Height = 615
Left = 3360
TabIndex = 14
Top = 4320
Width = 1215
End
Begin VB.OptionButton Female
Caption = "女"
Height = 180
Left = 840
TabIndex = 13
Top = 2400
Width = 975
End
Begin VB.OptionButton Male
Caption = "男"
Height = 180
Left = 840
TabIndex = 12
Top = 2160
Width = 975
End
Begin VB.TextBox py
Height = 375
Left = 840
TabIndex = 11
Top = 1560
Width = 1695
End
Begin VB.TextBox memberName
Height = 375
Left = 840
TabIndex = 1
Top = 960
Width = 1695
End
Begin VB.TextBox memberId
Height = 375
Left = 840
TabIndex = 0
Top = 360
Width = 1695
End
Begin VB.Label TipTime
Height = 375
Left = 3840
TabIndex = 23
Top = 2760
Width = 1455
End
Begin VB.Label Label1
Caption = "当前时间"
Height = 375
Left = 3000
TabIndex = 22
Top = 2760
Width = 735
End
Begin VB.Label Label9
Caption = "拼音简写"
Height = 375
Index = 8
Left = 0
TabIndex = 10
Top = 1560
Width = 735
End
Begin VB.Label Label9
Caption = "状态"
Height = 375
Index = 7
Left = 3000
TabIndex = 9
Top = 2160
Width = 735
End
Begin VB.Label Label9
Caption = "租金"
Height = 375
Index = 6
Left = 3000
TabIndex = 8
Top = 1560
Width = 735
End
Begin VB.Label Label9
Caption = "押金"
Height = 375
Index = 5
Left = 3000
TabIndex = 7
Top = 960
Width = 735
End
Begin VB.Label Label9
Caption = "电话"
Height = 375
Index = 4
Left = 0
TabIndex = 6
Top = 2760
Width = 735
End
Begin VB.Label Label9
Caption = "住址"
Height = 375
Index = 3
Left = 3000
TabIndex = 5
Top = 360
Width = 735
End
Begin VB.Label Label9
Caption = "姓名"
Height = 375
Index = 2
Left = 0
TabIndex = 4
Top = 960
Width = 735
End
Begin VB.Label Label9
Caption = "性别"
Height = 375
Index = 1
Left = 0
TabIndex = 3
Top = 2160
Width = 735
End
Begin VB.Label Label9
Caption = "编号"
Height = 375
Index = 0
Left = 0
TabIndex = 2
Top = 360
Width = 735
End
End
Attribute VB_Name = "addmember"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim GetId, GetName, GetPy, Gender, Phone, Address As String
Dim Deposit, Moneyleft, State As Integer
Dim JoinDate As Date
Private Sub activeState_Click()
State = 1
End Sub
Private Sub CancleSign_Click()
Unload Me
End Sub
Private Sub Female_Click()
Gender = "女"
End Sub
Private Sub Male_Click()
Gender = "男"
End Sub
Private Sub negetiveState_Click()
State = 0
End Sub
Private Sub SignIn_Click()
'On Error Resume Next
'Err.Clear
If TipTime.Caption <> "" Then
Timer1.Enabled = False
JoinDate = TipTime.Caption '将信息输入到保存到变量里
GetId = memberId
GetName = memberName
GetPy = py
Phone = memberPhone
Address = memberAddress
Deposit = memberDeposit
Moneyleft = memberMoney
If GetId = "" Or GetName = "" Or GetPy = "" Or Phone = "" Or Address = "" Or Deposit = "" Or Moneyleft = "" Then
MsgBox "所有项都必须填写", vbOKOnly, "错误"
Else
Dim rst As ADODB.Recordset '该记录集用于判断ID是否重复
Set rst = New ADODB.Recordset
rst.Open "select id from memberinfo where id='" & GetId & "'", cnn, adOpenDynamic, adLockReadOnly
If Not rst.EOF Then
MsgBox "该会员号已经在使用,请重新输入", vbOKOnly, "错误"
rst.Close
Set rst = Nothing
Else
cnn.Execute "insert into memberinfo(id,name,py,sex,phone,address,deposi,remainmoney,createdate,state) values('" _
& GetId & "','" & GetName & "','" & GetPy & "','" & Gender & "','" & Phone & "','" & Address & "'," & Deposit & "," & Moneyleft & ",'" _
& JoinDate & "'," & State & ")" '将输入的信息写入数据库中
'If Err.nuber <> 0 Then
' MsgBox "输入的数据有误,请仔细检查" & Err.Description, vbOKOnly, "操作失败"
'Else
' MsgBox "添加会员成功!", vbOKOnly, "操作成功"
'End If
rst.Close
Set rst = Nothing
MsgBox "添加会员成功!", vbOKOnly, "操作成功"
Timer1.Enabled = True
End If
End If
End If
End Sub
Private Sub Timer1_Timer()
TipTime.Caption = Now()
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -