📄 frm_live.frm
字号:
txt_man.Text = ""
txt_size.Text = ""
DTPicker1.Value = Date
Panduan1 = True
End Sub
Private Sub Command10_Click()
Unload Me
End Sub
Private Sub Command11_Click()
On Error Resume Next
Dim A, B, C, D, E, F, Key
Set Count1 = ExeCutesql("select key from 活期存取", Str_text)
If Count1.EOF Then
E = Null
End If
If IsNull(E) Then
Key = 1
Else
Count1.MoveLast
Key = Count1.Fields(0) + 1
End If
Set Note = ExeCutesql("select 余额 from 活期存取 ", Str_text)
If Note.EOF Then
D = Null
End If
If IsNull(D) Then
Set Money = ExeCutesql("select 款额 from 活期帐户 where 银行帐号='" & Combo1.Text & "'", Str_text)
C = Money.Fields(0)
Balance = C
Else
Note.MoveLast
Balance = Note.Fields(0)
End If
If Len(Combo1.Text) = 0 Then
MsgBox "请选择银行账号!", vbOKOnly + 32
End If
A = MsgBox("是否添加此条记录?", vbYesNo + 32, "添加记录")
If A = vbYes Then
If Panduan = True Then
Balance = Balance - CInt(Text1.Text)
ExeCutesql "insert into 活期存取 values('" & Combo1.Text & "','取款'," & Text1.Text & ",'" _
& Format(DTPicker2.Value, "yyyy-mm-dd") & "','" & Text2.Text & "','" & Balance & "','" & Key & "')", Str_text
Call Wangge
Text1.Enabled = False
Text2.Enabled = False
Text1.Text = ""
Text2.Text = ""
MsgBox "数据添加成功!", vbOKOnly, "成功"
Else
Balance = Balance + CInt(Text1.Text)
ExeCutesql "insert into 活期存取 values('" & Combo1.Text & "','存款'," & Text1.Text & ",'" _
& Format(DTPicker2.Value, "yyyy-mm-dd") & "','" & Text2.Text & "','" & Balance & "','" & Key & "')", Str_text
Call Wangge
Text1.Enabled = False
Text2.Enabled = False
Text1.Text = ""
Text2.Text = ""
MsgBox "数据添加成功!", vbOKOnly, "成功"
End If
End If
Command11.Enabled = False
End Sub
Private Sub Command12_Click()
On Error Resume Next
Mydb.MoveNext
If Mydb.EOF Then
Mydb.MoveLast
End If
End Sub
Private Sub Command13_Click()
On Error Resume Next
Mydb.MovePrevious
If Mydb.BOF Then
Mydb.MoveFirst
End If
End Sub
Private Sub Command2_Click()
Call Atrue
Panduan1 = False
End Sub
Private Sub Command3_Click()
Dim A
A = MsgBox("是否删除当前记录?", vbYesNo + 32 + 256, "删除记录")
If A = vbYes Then
If Mydb.EOF Then
Call Bangding
Exit Sub
Else
Mydb.Delete
End If
End If
Call Bangding
End Sub
Private Sub Command4_Click()
Unload Me
End Sub
Private Sub Command5_Click()
Dim A, B
If Panduan1 = True Then
A = MsgBox("是否添加此记录?", vbYesNo + 32, "")
If A = vbYes Then
ExeCutesql "insert into 活期帐户 values('" & Format(DTPicker1.Value, "yyyy-mm-dd") & "','" _
& txt_name.Text & "','" & txt_address.Text & "','" & txt_size.Text _
& "'," & CCur(txt_money.Text) & " ,'" & txt_man.Text & "') ", Str_text
Call Bangding
Call Afalse
End If
Else
B = MsgBox("是否修改前记录?", vbYesNo + 32, "添加记录")
If B = vbYes Then
ExeCutesql "Update 活期帐户 Set 开户日期 ='" & Format(DTPicker1.Value, "yyyy-mm-dd") & "',银行名称='" _
& txt_name.Text & "',银行地址='" & txt_address.Text & "',银行帐号 ='" & txt_size.Text _
& "',款额=" & CCur(txt_money.Text) & " ,开户人='" & txt_man.Text & "'", Str_text
Call Bangding
Call Afalse
MsgBox "Update 活期帐户 Set 开户日期 ='" & Format(DTPicker1.Value, "yyyy-mm-dd") & "',银行名称='" _
& txt_name.Text & "',银行地址='" & txt_address.Text & "',银行帐号 ='" & txt_size.Text _
& "',款额=" & CCur(txt_money.Text) & " ,开户人='" & txt_man.Text & "'"
MsgBox "数据修改成功!", vbOKOnly + 64, "成功"
End If
End If
End Sub
Private Sub Command6_Click()
Panduan = True
Command11.Enabled = True
Text1.Enabled = True
Text2.Enabled = True
End Sub
Private Sub Command7_Click()
Panduan = False
Command11.Enabled = True
Text1.Enabled = True
Text2.Enabled = True
End Sub
Private Sub Command9_Click()
On Error Resume Next
Dim A, B, C, I, Ab, Bc, CC
Bc = CInt(txt_key.Text)
Set AA = ExeCutesql("select key from 活期存取", Str_text)
If AA.EOF Then
Exit Sub
End If
AA.MoveLast
C = AA.Fields(0)
B = C - Bc
A = MsgBox("是否删除当前记录?", vbYesNo + 32 + 256, "添加记录")
If A = vbYes Then
ExeCutesql "delete from 活期存取 where key=" & txt_key.Text & " ", Str_text
For I = Bc To C
Set BB = ExeCutesql("select 余额 from 活期存取 where key=" & I & " ", Str_text)
'If BB.EOF Then Exit Sub
Ab = BB.Fields(0)
CC = Ab - CInt(Text1.Text)
'MsgBox CC
ExeCutesql "update 活期存取 set 余额=" & CC & " where key = " & I & "", Str_text
'MsgBox "update 活期存取 set 余额=" & CC & " where key = " & I & ""
Next I
Call Wangge
Call MSHFlexGrid1_Click
End If
End Sub
Private Sub Form_Load()
On Error Resume Next
Dim A As Integer
Set Mydb3 = ExeCutesql("select sum(数目) from 活期存取", Str_text)
Balance = Mydb3.Fields(0)
Call Bangding
Call Afalse
Command11.Enabled = False
Text1.Enabled = False
Text2.Enabled = False
DTPicker1.Value = Date
DTPicker2.Value = Date
End Sub
Private Sub MSHFlexGrid1_Click()
On Error Resume Next
DTPicker2.Value = MSHFlexGrid1.TextMatrix(MSHFlexGrid1.Row, 1)
Text1.Text = MSHFlexGrid1.TextMatrix(MSHFlexGrid1.Row, 4)
Text2.Text = MSHFlexGrid1.TextMatrix(MSHFlexGrid1.Row, 2)
txt_key.Text = MSHFlexGrid1.TextMatrix(MSHFlexGrid1.Row, 6)
'Yuen = MSHFlexGrid1.TextMatrix(MSHFlexGrid1.Row, 5)
End Sub
Private Sub SSTab1_Click(PreviousTab As Integer)
On Error Resume Next
Dim A As Integer
If SSTab1.Caption = "取款记录" Then
Set Mydb1 = ExeCutesql("select 银行帐号 from 活期帐户", Str_text)
A = Mydb1.RecordCount
For I = 1 To A
Combo1.AddItem Mydb1.Fields(0)
Mydb1.MoveNext
If Mydb1.EOF Then Exit For
Next I
End If
End Sub
Private Sub Text1_LostFocus()
Dim A As Boolean
Dim C
C = Text1.Text
A = IsNumeric(C)
If C = "" Then
MsgBox "请输入金额!", vbOKOnly + 32, "注意!"
Text1.SetFocus
Else
If A = False Then
MsgBox "金额只能输入数字!", vbOKOnly + 32, "注意!"
Text1.SetFocus
End If
End If
End Sub
Private Sub txt_money_LostFocus()
Dim A As Boolean
Dim C
C = txt_money.Text
A = IsNumeric(C)
If C = "" Then
MsgBox "请输入金额!", vbOKOnly + 32, "注意!"
txt_money.SetFocus
Else
If A = False Then
MsgBox "金额只能输入数字!", vbOKOnly + 32, "注意!"
txt_money.SetFocus
End If
End If
End Sub
Private Function Bangding()
On Error Resume Next
Set Mydb = ExeCutesql("select * from 活期帐户", Str_text)
Mydb.MoveFirst
Set txt_date.DataSource = Mydb
Set txt_money1.DataSource = Mydb
Set txt_name1.DataSource = Mydb
Set txt_address1.DataSource = Mydb
Set txt_man1.DataSource = Mydb
Set txt_size1.DataSource = Mydb
txt_date.DataField = "开户日期"
txt_money1.DataField = "款额"
txt_name1.DataField = "银行名称"
txt_address1.DataField = "银行地址"
txt_man1.DataField = "开户人"
txt_size1.DataField = "银行帐号"
Label21.Caption = Mydb.RecordCount
End Function
Private Function Atrue()
txt_money.Locked = False
txt_name.Locked = False
txt_address.Locked = False
txt_man.Locked = False
txt_size.Locked = False
Command5.Enabled = True
End Function
Private Function Afalse()
txt_money.Locked = True
txt_name.Locked = True
txt_address.Locked = True
txt_man.Locked = True
txt_size.Locked = True
Command5.Enabled = False
End Function
Private Function Wangge()
Set Mydb2 = ExeCutesql("select 日期, 姓名, 存取,数目,余额,key from 活期存取 where 帐号='" & Combo1.Text & "'", Str_text)
Set MSHFlexGrid1.DataSource = Mydb2
End Function
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -