📄 add_consume_form.frm
字号:
VERSION 5.00
Begin VB.Form Add_Consume_Form
BorderStyle = 1 'Fixed Single
Caption = "Adding Consume"
ClientHeight = 2565
ClientLeft = 45
ClientTop = 330
ClientWidth = 4680
LinkTopic = "Form1"
MaxButton = 0 'False
MDIChild = -1 'True
MinButton = 0 'False
ScaleHeight = 2565
ScaleWidth = 4680
Begin VB.CommandButton AddConsume_Comm
Caption = "保存"
Height = 495
Left = 1920
TabIndex = 4
Top = 1920
Width = 1215
End
Begin VB.TextBox Text2
BeginProperty DataFormat
Type = 1
Format = "0"
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 2052
SubFormatType = 1
EndProperty
Height = 495
Left = 1680
TabIndex = 1
Text = "0"
Top = 840
Width = 2415
End
Begin VB.TextBox Text1
Height = 495
Left = 1680
TabIndex = 0
Text = "0"
Top = 120
Width = 2415
End
Begin VB.Label Label2
Caption = "消费额:"
Height = 495
Left = 240
TabIndex = 3
Top = 840
Width = 1215
End
Begin VB.Label Label1
Caption = "卡号:"
Height = 495
Left = 240
TabIndex = 2
Top = 120
Width = 1215
End
End
Attribute VB_Name = "Add_Consume_Form"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim consume_conn As New Class1
Dim consume_rs As New Class1
Private Sub AddConsume_Comm_Click()
Dim cardnumber As Integer, consume As Single
Dim str As String, myxf As Single, refer_id As Single, CardType As String
If consume_conn.ocn.State = False Then
consume_conn.ocn.ConnectionString = "provider=microsoft.jet.oledb.4.0;data source=DATA.mdb;Persist security info=false"
consume_conn.ocn.Open
End If
cardnumber = CInt(Text1.Text)
consume = CSng(Text2.Text)
If consume_rs.rs.State = 1 Then
consume_rs.rs.Close
Set consume_rs.rs = Nothing
End If
str = "select*from userlist where cardno=" & cardnumber
consume_rs.rs.Open str, consume_conn.ocn, 1, 1
If consume_rs.rs.BOF Then
MsgBox "卡号不存在"
Text1.SetFocus
Else
refer_id = consume_rs.rs("id")
consume_conn.ocn.Execute "insert into xflist(id,username,cardno,xf,xftime)values('" & refer_id & "','" & consume_rs.rs("username") & "','" & cardnumber & "','" & consume & "',now())"
If consume_rs.rs.State = 1 Then
consume_rs.rs.Close
Set consume_rs.rs = Nothing
consume_rs.rs.Open "select sum(xf) from xflist where id=" & refer_id, consume_conn.ocn, 1, 1
myxf = CSng(consume_rs.rs.Fields.Item(0).Value)
Select Case myxf
Case Is <= 6000
CardType = "普通会员"
Case 6000 To 7999
CardType = "普通卡"
Case 8000 To 9999
CardType = "银卡"
Case Is >= 10000
CardType = "金卡"
End Select
consume_conn.ocn.Execute ("update userlist set allxf='" & myxf & "',cardtype='" & CardType & "',lastxf='" & consume & "' where id=" & refer_id)
End If
End If
Unload Me
End Sub
Private Sub Text1_Change()
If IsNumeric(Text1.Text) = False Then
MsgBox "data is not allowed"
Text1.SetFocus
End If
End Sub
Private Sub Text2_Change()
If IsNumeric(Text2.Text) = False Then
MsgBox "数据类型错误"
Text2.SetFocus
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -