?? form7.frm
字號:
VERSION 5.00
Begin VB.Form Form7
BorderStyle = 1 'Fixed Single
Caption = "Form7"
ClientHeight = 5850
ClientLeft = 45
ClientTop = 435
ClientWidth = 7200
LinkTopic = "Form7"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 5850
ScaleWidth = 7200
StartUpPosition = 3 '窗口缺省
Begin VB.TextBox Text1
BeginProperty Font
Name = "宋體"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 440
Left = 3240
TabIndex = 7
Text = "0"
Top = 4440
Width = 1615
End
Begin VB.ComboBox Combo1
BeginProperty Font
Name = "宋體"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 360
Left = 3240
TabIndex = 1
Top = 960
Width = 1615
End
Begin VB.TextBox Text6
BeginProperty Font
Name = "宋體"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 420
Left = 3240
TabIndex = 6
Text = "0"
Top = 3840
Width = 1615
End
Begin VB.TextBox Text5
BeginProperty Font
Name = "宋體"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 420
Left = 3240
TabIndex = 5
Top = 3240
Width = 1615
End
Begin VB.CommandButton Command1
Caption = "保存數據"
BeginProperty Font
Name = "宋體"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 540
Left = 2640
TabIndex = 8
Top = 5040
Width = 1815
End
Begin VB.TextBox Text4
BeginProperty Font
Name = "宋體"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 420
Left = 3240
TabIndex = 4
Top = 2640
Width = 1615
End
Begin VB.TextBox Text3
BeginProperty Font
Name = "宋體"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 420
Left = 3240
TabIndex = 3
Top = 2040
Width = 1615
End
Begin VB.TextBox Text2
BeginProperty Font
Name = "宋體"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 420
Left = 3240
TabIndex = 2
Top = 1440
Width = 1615
End
Begin VB.Label Label8
Caption = "未還金額:"
BeginProperty Font
Name = "宋體"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 2040
TabIndex = 15
Top = 4560
Width = 1215
End
Begin VB.Label Label7
AutoSize = -1 'True
Caption = "收回金額:"
BeginProperty Font
Name = "宋體"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 240
Left = 2040
TabIndex = 14
Top = 3960
Width = 1200
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
Height = 240
Left = 2040
TabIndex = 13
Top = 3360
Width = 1200
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
Height = 240
Left = 2040
TabIndex = 12
Top = 2760
Width = 1200
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
Height = 240
Left = 2040
TabIndex = 11
Top = 2160
Width = 1200
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
Height = 240
Left = 2040
TabIndex = 10
Top = 1560
Width = 1200
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
Height = 240
Left = 2040
TabIndex = 9
Top = 960
Width = 1200
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "欠款收回輸入畫面"
BeginProperty Font
Name = "黑體"
Size = 15.75
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 315
Left = 2280
TabIndex = 0
Top = 240
Width = 2520
End
End
Attribute VB_Name = "Form7"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim f_repay_money
Private Sub Command1_Click()
Dim cnn1 As ADODB.Connection
Dim cmd1 As ADODB.Command
Dim rs1 As ADODB.Recordset
If Text6.Text = 0 Then
MsgBox ("欠款金額不能為零")
Text6.SetFocus
GoSub exit_Command1_Click
End If
Set cnn1 = New ADODB.Connection
cnn1.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=C:\Documents and Settings\jujumao\My Documents\粵豐飼料\粵豐飼料經營情況.mdb;"
Set cmd1 = New ADODB.Command
SQL = "select count(*),max(編號) from 欠款收回表"
With cmd1
.ActiveConnection = cnn1
.CommandText = SQL
.CommandType = adCmdText
End With
Set rs1 = cmd1.Execute
rs1.MoveFirst
If rs1.Fields(0) = 0 Then
t_max_row = 0
Else
t_max_row = rs1.Fields(1) + 1
End If
SQL = "INSERT INTO 欠款收回表(編號,帳本號, 帳單號,年份,月份,日期,收回金額" & _
") VALUES ( " & t_max_row & "," & "'" & Combo1.Text & "'" & "," & "'" & Text2.Text & "'" & "," & _
Text3.Text & "," & Text4.Text & "," & Text5.Text & "," & Text6.Text & ")"
With cmd1
.ActiveConnection = cnn1
.CommandText = SQL
.CommandType = adCmdText
.Execute
End With
SQL = "update 帳單表 set 還款金額= " & (f_repay_money + Text6.Text) & _
" where 帳本號=" & "'" & Combo1.Text & "'" & " and 帳單號= " & "'" & _
Text2.Text & "'"
With cmd1
.ActiveConnection = cnn1
.CommandText = SQL
.CommandType = adCmdText
.Execute
End With
cnn1.Close
Set cnn1 = Nothing
Text2.Text = ""
Text5.Text = ""
Text6.Text = 0
Text1.Text = 0
MsgBox ("數據保存成功")
Text1.SetFocus
exit_Command1_Click:
End Sub
Private Sub Command2_Click()
Unload Form7
Form2.Show
End Sub
Private Sub Form_Load()
Dim cnn1 As ADODB.Connection
Dim cmd1 As ADODB.Command
Dim rs As ADODB.Recordset
Set cnn1 = New ADODB.Connection
Set rs = New ADODB.Recordset
cnn1.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Documents and Settings\jujumao\My Documents\粵豐飼料\粵豐飼料經營情況.mdb;Persist Security Info=False"
Set cmd1 = New ADODB.Command
SQL = "select 帳本號 from 帳本表 "
'where 使用年份=" & g_year
With cmd1
.ActiveConnection = cnn1
.CommandText = SQL
.CommandType = adCmdText
End With
Set rs1 = cmd1.Execute
rs1.MoveFirst
i = 0
While Not rs1.EOF
Combo1.AddItem rs1.Fields(0), i
rs1.MoveNext
i = i + 1
Wend
cnn1.Close
Set cnn1 = Nothing
Text3.Text = g_year
Text4.Text = g_month
Text6.Text = 0
End Sub
Private Sub Form_Unload(Cancel As Integer)
Form2.Show
End Sub
Private Sub Text1_GotFocus()
Combo1.SetFocus
End Sub
Private Sub Text2_LostFocus()
Dim cnn1 As ADODB.Connection
Dim cmd1 As ADODB.Command
Dim rs1 As ADODB.Recordset
Set cnn1 = New ADODB.Connection
cnn1.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=C:\Documents and Settings\jujumao\My Documents\粵豐飼料\粵豐飼料經營情況.mdb;"
Set cmd1 = New ADODB.Command
SQL = "SELECT 欠款金額,還款金額 from 帳單表 where 帳本號= " & "'" & Combo1.Text & _
"'" & " and 帳單號=" & "'" & Text2.Text & "'"
With cmd1
.ActiveConnection = cnn1
.CommandText = SQL
.CommandType = adCmdText
End With
Set rs1 = cmd1.Execute
If rs1.EOF Then
MsgBox ("沒有查到對應的帳單號,請確認輸入正確!")
Text2.SetFocus
cnn1.Close
Set cnn1 = Nothing
GoSub exit_text2_lostfocus
End If
rs1.MoveFirst
t_owe_money = rs1.Fields(0)
f_repay_money = rs1.Fields(1)
Text1.Text = t_owe_money - f_repay_money
cnn1.Close
Set cnn1 = Nothing
exit_text2_lostfocus:
End Sub
Private Sub Text4_GotFocus()
Text5.SetFocus
End Sub
Private Sub Text3_GotFocus()
Text5.SetFocus
End Sub
Private Sub Text6_LostFocus()
If Text6.Text - Text1.Text > 0 Then
MsgBox ("收回金額不能大于未還金額!")
Text6.SetFocus
End If
End Sub
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -