📄 form_ding.frm
字号:
Begin VB.Label Label7
Caption = "支出金额: "
Height = 255
Left = -74400
TabIndex = 23
Top = 2400
Width = 975
End
Begin VB.Label Label8
Caption = "备注: "
Height = 375
Left = -71160
TabIndex = 22
Top = 720
Width = 1215
End
Begin VB.Label Label15
Caption = "经手人: "
Height = 255
Left = -74400
TabIndex = 21
Top = 1840
Width = 975
End
Begin VB.Label Label1
Caption = "账号: "
Height = 375
Left = -74640
TabIndex = 13
Top = 600
Width = 1335
End
Begin VB.Label Label2
Caption = "日期: "
Height = 375
Left = -74640
TabIndex = 12
Top = 1200
Width = 1335
End
Begin VB.Label Label3
Caption = "存入金额: "
Height = 375
Left = -74640
TabIndex = 11
Top = 2400
Width = 1335
End
Begin VB.Label Label4
Caption = "备注: "
Height = 375
Left = -71280
TabIndex = 10
Top = 600
Width = 1335
End
Begin VB.Label Label14
Caption = "经手人: "
Height = 375
Left = -74640
TabIndex = 9
Top = 1800
Width = 1335
End
End
Begin MSDataGridLib.DataGrid DataGrid_Ding
Bindings = "Form_Ding.frx":0054
Height = 2655
Left = 120
TabIndex = 0
Top = 120
Width = 7455
_ExtentX = 13150
_ExtentY = 4683
_Version = 393216
AllowUpdate = 0 'False
HeadLines = 1
RowHeight = 15
BeginProperty HeadFont {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ColumnCount = 2
BeginProperty Column00
DataField = ""
Caption = ""
BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED}
Type = 0
Format = ""
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 2052
SubFormatType = 0
EndProperty
EndProperty
BeginProperty Column01
DataField = ""
Caption = ""
BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED}
Type = 0
Format = ""
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 2052
SubFormatType = 0
EndProperty
EndProperty
SplitCount = 1
BeginProperty Split0
BeginProperty Column00
EndProperty
BeginProperty Column01
EndProperty
EndProperty
End
End
Attribute VB_Name = "Form_定期账户"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click() '添加一个存款记录
Dim sqlstr As String
Dim num As Integer
Dim no As Integer
Dim rsdb As New ADODB.Recordset
If Me.Combo1.Text = "" Or Me.DTPicker1.Value = "" Or Me.Text_Live_Cun.Text = "" Or Me.Combo4.Text = "" Then
MsgBox "不能空白!"
Exit Sub
End If
If Not IsNumeric(Me.Text_Live_Cun.Text) Then
MsgBox "存入金额必须是数字"
Exit Sub
End If
'On Error Resume Next
'查找对应账号的编号
rsdb.Open "select * from FixBank where FixBankNo=" & "'" & Me.Combo1.Text & "'", RemoteCnn, adOpenStatic, adLockReadOnly, -1
If rsdb.RecordCount > 0 Then
If Not rsdb.EOF Then rsdb.MoveFirst
num = Val(rsdb.Fields("FixBankID").Value)
End If
rsdb.Close
'查找对应经手人的编号
rsdb.Open "select * from Family where FamilyName=" & "'" & Me.Combo4.Text & "'", RemoteCnn, adOpenStatic, adLockReadOnly, -1
If rsdb.RecordCount > 0 Then
If Not rsdb.EOF Then rsdb.MoveFirst
no = Val(rsdb.Fields("FamilyID").Value)
End If
rsdb.Close
'添加一个存款记录到数据库
sqlstr = "insert into FixAction" & "(FixActionNo,FixActionDate,FixActionName,FixActionCun,FixActionBZ)" & _
"values(" & num & "," & _
"'" & Me.DTPicker1.Value & "'," & _
no & "," & _
Val(Me.Text_Live_Cun.Text) & "," & _
"'" & Me.Text_Live_BZ1.Text & "');"
RemoteCnn.Execute sqlstr
MsgBox "添加成功"
'界面更新
Me.Adodc_Ding.Refresh
Me.Combo1.Text = ""
Me.Text_Live_Cun.Text = ""
Me.Combo4.Text = ""
Me.Text_Live_BZ1 = ""
End Sub
Private Sub Command2_Click()
Unload Me
End Sub
Private Sub Command3_Click() '添加一个取款记录
Dim sqlstr As String
Dim num As Integer
Dim no As Integer
Dim rsdb As New ADODB.Recordset
If Me.Combo2.Text = "" Or Me.DTPicker2.Value = "" Or Me.Text_Live_QU.Text = "" Or Me.Combo5.Text = "" Then
MsgBox "不能空白!"
Exit Sub
End If
If Not IsNumeric(Me.Text_Live_QU.Text) Then
MsgBox "支出金额必须是数字"
Exit Sub
End If
On Error Resume Next
'查找对应账号的编号
rsdb.Open "select * from FixBank where FixBankNo=" & "'" & Me.Combo2.Text & "'", RemoteCnn, adOpenStatic, adLockReadOnly, -1
If rsdb.RecordCount > 0 Then
If Not rsdb.EOF Then rsdb.MoveFirst
num = Val(rsdb.Fields("FixBankID").Value)
End If
rsdb.Close
'查找对应经手人的编号
rsdb.Open "select * from Family where FamilyName=" & "'" & Me.Combo5.Text & "'", RemoteCnn, adOpenStatic, adLockReadOnly, -1
If rsdb.RecordCount > 0 Then
If Not rsdb.EOF Then rsdb.MoveFirst
no = Val(rsdb.Fields("FamilyID").Value)
End If
rsdb.Close
'添加一个取款记录到数据库
sqlstr = "insert into FixAction" & "(FixActionNo,FixActionDate,FixActionName,FixActionQu,FixActionBZ)" & _
"values(" & num & "," & _
"'" & Me.DTPicker1.Value & "'," & _
no & "," & _
Val(Me.Text_Live_QU.Text) & "," & _
"'" & Me.Text_Live_BZ2.Text & "');"
RemoteCnn.Execute sqlstr
MsgBox "添加成功"
'界面更新
Me.Adodc_Ding.Refresh
Me.Combo2.Text = ""
Me.Text_Live_QU.Text = ""
Me.Combo5.Text = ""
Me.Text_Live_BZ2 = ""
End Sub
Private Sub Command4_Click()
Unload Me
End Sub
Private Sub Command5_Click() '修改一个选定的记录
Dim sqlstr As String
Dim num As Integer
Dim no As Integer
Dim rsdb As New ADODB.Recordset
If Me.Combo3.Text = "" Or Me.DTPicker3.Value = "" Or Me.Combo6.Text = "" Or Me.Text_Live_CUN_M.Text = "" Or Me.Text_Live_QU_M.Text = "" Then
MsgBox "不能空白"
Exit Sub
End If
If Not IsNumeric(Me.Text_Live_CUN_M.Text) Then
MsgBox "存入金额必须是数字"
Exit Sub
End If
If Not IsNumeric(Me.Text_Live_QU_M.Text) Then
MsgBox "支出金额必须是数字"
Exit Sub
End If
On Error Resume Next
'查找对应账号的编号
rsdb.Open "select * from FixBank where FixBankNo=" & "'" & Me.Combo3.Text & "'", RemoteCnn, adOpenStatic, adLockReadOnly, -1
If rsdb.RecordCount > 0 Then
If Not rsdb.EOF Then rsdb.MoveFirst
num = Val(rsdb.Fields("FixBankID").Value)
End If
rsdb.Close
'查找对应经手人的编号
rsdb.Open "select * from Family where FamilyName=" & "'" & Me.Combo6.Text & "'", RemoteCnn, adOpenStatic, adLockReadOnly, -1
If rsdb.RecordCount > 0 Then
If Not rsdb.EOF Then rsdb.MoveFirst
no = Val(rsdb.Fields("FamilyID").Value)
End If
rsdb.Close
'在数据库中修改选定的记录
sqlstr = "update FixAction set FixActionNo=" & num & "," & _
"FixActionDate=" & "'" & Me.DTPicker3.Value & "'," & _
"FixActionName=" & no & "," & _
"FixActionCun=" & Val(Me.Text_Live_CUN_M.Text) & "," & _
"FixActionQu=" & Val(Me.Text_Live_QU_M.Text) & "," & _
"FixActionBZ=" & "'" & Me.Text_Live_BZ3.Text & "' " & _
"where FixActionID=" & Val(DataGrid_Ding.Columns(0).Text)
RemoteCnn.Execute sqlstr
MsgBox "修改成功!"
'界面更新
Me.Adodc_Ding.Refresh
End Sub
Private Sub Command6_Click() '删除一个选定的记录
'是否选择了记录
If Me.DataGrid_Ding.Row = -1 Then
MsgBox "没有数据"
Exit Sub
End If
'删除选定的记录
Me.Adodc_Ding.Recordset.Delete
MsgBox "删除成功"
End Sub
Private Sub Command7_Click()
Unload Me
End Sub
Private Sub DataGrid_Ding_Click() '选择一个要编辑的记录
Dim rsdb As New ADODB.Recordset
Dim str As String
Dim name As String
On Error Resume Next
'查找对应编号的姓名
rsdb.Open "select * from Family where FamilyID=" & Val(DataGrid_Ding.Columns(3).Text), RemoteCnn, adOpenStatic, adLockReadOnly, -1
If rsdb.RecordCount > 0 Then
If Not rsdb.EOF Then rsdb.MoveFirst
name = rsdb.Fields("FamilyName").Value
End If
rsdb.Close
'查找对应编号的账号
rsdb.Open "select * from FixBank where FixBankID=" & Val(DataGrid_Ding.Columns(1).Text), RemoteCnn, adOpenStatic, adLockReadOnly, -1
If rsdb.RecordCount > 0 Then
If Not rsdb.EOF Then rsdb.MoveFirst
str = rsdb.Fields("FixBankNo").Value
End If
rsdb.Close
'在界面上显示选定的记录
Me.Combo3.Text = str
Me.DTPicker3.Value = DataGrid_Ding.Columns(2).Text
Me.Combo6.Text = name
Me.Text_Live_CUN_M.Text = DataGrid_Ding.Columns(4).Text
Me.Text_Live_QU_M.Text = DataGrid_Ding.Columns(5).Text
Me.Text_Live_BZ3.Text = DataGrid_Ding.Columns(6).Text
End Sub
Private Sub Form_Load() '窗体装载
Dim rsdb As New ADODB.Recordset
Dim str As String
Dim i As Integer
On Error Resume Next
'填充账号框
rsdb.Open "select * from FixBank", RemoteCnn, adOpenStatic, adLockReadOnly, -1
If rsdb.RecordCount > 0 Then
If Not rsdb.BOF Then rsdb.MoveFirst
For i = 1 To rsdb.RecordCount
Me.Combo1.AddItem rsdb.Fields("FixBankNo").Value
Me.Combo2.AddItem rsdb.Fields("FixBankNo").Value
Me.Combo3.AddItem rsdb.Fields("FixBankNo").Value
If Not rsdb.EOF Then rsdb.MoveNext
Next i
End If
rsdb.Close
'填充经手人框
rsdb.Open "select * from Family", RemoteCnn, adOpenStatic, adLockReadOnly, -1
If rsdb.RecordCount > 0 Then
If Not rsdb.BOF Then rsdb.MoveFirst
For i = 1 To rsdb.RecordCount
Me.Combo4.AddItem rsdb.Fields("FamilyName").Value
Me.Combo5.AddItem rsdb.Fields("FamilyName").Value
Me.Combo6.AddItem rsdb.Fields("FamilyName").Value
If Not rsdb.EOF Then rsdb.MoveNext
Next i
End If
rsdb.Close
'打开定期账户操作表并填充表格
Me.Adodc_Ding.ConnectionString = "Provider=MSDASQL.1;Persist Security Info=False;User ID=" & UID & ";pwd=" & PWD & ";Data Source=" & MyDSN
Adodc_Ding.RecordSource = "select FixActionID as 编号,FixActionNo as 账户编号,FixActionDate as 日期,FixActionName as 经手人,FixActionCun as 存入金额,FixActionQu as 支出金额,FixActionBZ as 备注 from FixAction"
Adodc_Ding.Refresh
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -