?? frm_live.frm
字號:
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
'Set txt_money.DataSource = Mydb
'Set txt_name.DataSource = Mydb
'Set txt_address.DataSource = Mydb
'Set txt_man.DataSource = Mydb
'Set txt_size.DataSource = Mydb
'Set DTPicker1.DataSource = Mydb
'DTPicker1.Value = "開戶日期"
'txt_money.DataField = "款額"
'txt_name.DataField = "銀行名稱"
'txt_address.DataField = "銀行地址"
'txt_man.DataField = "開戶人"
'txt_size.DataField = "銀行帳號"
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 + -