⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 form_income.frm

📁 个人理财系统
💻 FRM
字号:
VERSION 5.00
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Object = "{CDE57A40-8B86-11D0-B3C6-00A0C90AEA82}#1.0#0"; "MSDATGRD.OCX"
Object = "{86CF1D34-0C5F-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCT2.OCX"
Begin VB.Form Form_日常收入 
   Caption         =   "日常收入"
   ClientHeight    =   5190
   ClientLeft      =   3990
   ClientTop       =   2655
   ClientWidth     =   8175
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   ScaleHeight     =   5190
   ScaleWidth      =   8175
   Begin MSAdodcLib.Adodc Adodc_Income 
      Height          =   330
      Left            =   360
      Top             =   4680
      Visible         =   0   'False
      Width           =   1200
      _ExtentX        =   2117
      _ExtentY        =   582
      ConnectMode     =   0
      CursorLocation  =   3
      IsolationLevel  =   -1
      ConnectionTimeout=   15
      CommandTimeout  =   30
      CursorType      =   3
      LockType        =   3
      CommandType     =   8
      CursorOptions   =   0
      CacheSize       =   50
      MaxRecords      =   0
      BOFAction       =   0
      EOFAction       =   0
      ConnectStringType=   1
      Appearance      =   1
      BackColor       =   -2147483643
      ForeColor       =   -2147483640
      Orientation     =   0
      Enabled         =   -1
      Connect         =   ""
      OLEDBString     =   ""
      OLEDBFile       =   ""
      DataSourceName  =   ""
      OtherAttributes =   ""
      UserName        =   ""
      Password        =   ""
      RecordSource    =   ""
      Caption         =   "Adodc1"
      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
      _Version        =   393216
   End
   Begin MSDataGridLib.DataGrid DataGrid_Income 
      Bindings        =   "Form_Income.frx":0000
      Height          =   2415
      Left            =   120
      TabIndex        =   4
      Top             =   120
      Width           =   7935
      _ExtentX        =   13996
      _ExtentY        =   4260
      _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
   Begin VB.CommandButton Command4 
      Caption         =   "退出"
      Height          =   375
      Left            =   6360
      TabIndex        =   3
      Top             =   4680
      Width           =   1335
   End
   Begin VB.CommandButton Command3 
      Caption         =   "删除"
      Height          =   375
      Left            =   4800
      TabIndex        =   2
      Top             =   4680
      Width           =   1335
   End
   Begin VB.CommandButton Command2 
      Caption         =   "修改"
      Height          =   375
      Left            =   3240
      TabIndex        =   1
      Top             =   4680
      Width           =   1335
   End
   Begin VB.CommandButton Command1 
      Caption         =   "添加"
      Height          =   375
      Left            =   1680
      TabIndex        =   0
      Top             =   4680
      Width           =   1335
   End
   Begin VB.Frame Frame1 
      Height          =   1935
      Left            =   120
      TabIndex        =   5
      Top             =   2640
      Width           =   7935
      Begin VB.TextBox Text_Income_BZ 
         Height          =   855
         Left            =   4800
         TabIndex        =   14
         Top             =   960
         Width           =   2895
      End
      Begin VB.TextBox Text_Income_money 
         Height          =   375
         Left            =   4800
         TabIndex        =   13
         Top             =   360
         Width           =   1455
      End
      Begin VB.ComboBox Combo2 
         Height          =   315
         Left            =   1440
         TabIndex        =   11
         Top             =   1440
         Width           =   1455
      End
      Begin VB.ComboBox Combo1 
         Height          =   315
         Left            =   1440
         TabIndex        =   9
         Top             =   900
         Width           =   1455
      End
      Begin MSComCtl2.DTPicker DTPicker1 
         Height          =   315
         Left            =   1440
         TabIndex        =   6
         Top             =   360
         Width           =   1455
         _ExtentX        =   2566
         _ExtentY        =   556
         _Version        =   393216
         Format          =   25559041
         CurrentDate     =   38792
      End
      Begin VB.Label Label5 
         Caption         =   "备注:"
         Height          =   375
         Left            =   3480
         TabIndex        =   15
         Top             =   840
         Width           =   855
      End
      Begin VB.Label Label4 
         Caption         =   "收入金额:"
         Height          =   375
         Left            =   3480
         TabIndex        =   12
         Top             =   480
         Width           =   1095
      End
      Begin VB.Label Label3 
         Caption         =   "收入来源:"
         Height          =   375
         Left            =   120
         TabIndex        =   10
         Top             =   1440
         Width           =   975
      End
      Begin VB.Label Label2 
         Caption         =   "收入人员:"
         Height          =   375
         Left            =   120
         TabIndex        =   8
         Top             =   900
         Width           =   975
      End
      Begin VB.Label Label1 
         Caption         =   "收入日期:"
         Height          =   375
         Left            =   120
         TabIndex        =   7
         Top             =   360
         Width           =   975
      End
   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 rsdb As New ADODB.Recordset
Dim num As Integer
If Me.DTPicker1.Value = "" Or Me.Text_Income_money = "" Or _
Me.Combo1.Text = "" Or Me.Combo2.Text = "" Then
    MsgBox "不能空白!"
    Exit Sub
End If

If Not IsNumeric(Me.Text_Income_money) Then
    MsgBox "收入金额必须是数字"
    Exit Sub
End If

'On Error Resume Next
'找到对应的人员编号
rsdb.Open "select * from Family where FamilyName=" & "'" & _
Me.Combo1.Text & "'", RemoteCnn, adOpenStatic, adLockReadOnly, -1
    If rsdb.RecordCount > 0 Then
        If Not rsdb.EOF Then rsdb.MoveFirst
        num = Val(rsdb.Fields("FamilyID").Value)
    End If
rsdb.Close
'添加到数据库
sqlstr = "insert into DailyIncome" & "(DailyIncomeDate," & _
        "DailyIncomeName,DailyIncomeType,DailyIncomeNum,DailyIncomeBZ)" & _
        "values(" & "'" & Me.DTPicker1.Value & "'," & _
                    num & "," & _
                    Val(Me.Combo2.Text) & "," & _
                    Val(Me.Text_Income_money.Text) & "," & _
                    "'" & Me.Text_Income_BZ.Text & "');"
RemoteCnn.Execute sqlstr
MsgBox "添加成功!"
'刷新界面显示
Me.Adodc_Income.Refresh
End Sub

Private Sub Command2_Click()    '修改一个记录
Dim sqlstr As String
Dim rsdb As New ADODB.Recordset
Dim num As Integer
If Me.DTPicker1.Value = "" Or Me.Text_Income_money = "" Or _
Me.Combo1.Text = "" Or Me.Combo2.Text = "" Then
    MsgBox "不能空白!"
    Exit Sub
End If
'On Error Resume Next
'找到对应的人员编号
rsdb.Open "select * from Family where FamilyName=" & _
"'" & Me.Combo1.Text & "'", RemoteCnn, adOpenStatic, adLockReadOnly, -1
    If rsdb.RecordCount > 0 Then
        If Not rsdb.EOF Then rsdb.MoveFirst
        num = Val(rsdb.Fields("FamilyID").Value)
    End If
rsdb.Close
'对数据库中的数据进行修改
sqlstr = "update DailyIncome set DailyIncomeDate=" & _
                        "'" & Me.DTPicker1.Value & "'," & _
                        "DailyIncomeName=" & num & "," & _
                        "DailyIncomeType=" & Val(Me.Combo2.Text) & "," & _
                        "DailyIncomeNum=" & Val(Me.Text_Income_money.Text) & "," & _
                        "DailyIncomeBZ=" & "'" & Me.Text_Income_BZ.Text & "' " & _
                        "where DailyIncomeID=" & Val(DataGrid_Income.Columns(0).Text)
RemoteCnn.Execute sqlstr
MsgBox "修改成功!"
'刷新界面显示
Me.Adodc_Income.Refresh
End Sub

Private Sub Command3_Click()    '删除一个记录
'是否选择了要删除的对象
If Me.DataGrid_Income.Row = -1 Then
    MsgBox "没有数据"
    Exit Sub
End If
'删除选定的对象
Me.Adodc_Income.Recordset.Delete
MsgBox "删除成功"
End Sub

Private Sub Command4_Click()
Unload Me
End Sub

Private Sub DataGrid_Income_Click()     '选择一个记录
Dim str As String
Dim rsdb As New ADODB.Recordset
'查找对应于人员编号的名字
rsdb.Open "select * from Family where FamilyID=" & _
Val(DataGrid_Income.Columns(2).Text), RemoteCnn, adOpenStatic, adLockReadOnly, -1
    If rsdb.RecordCount > 0 Then
        If Not rsdb.EOF Then rsdb.MoveFirst
        str = rsdb.Fields("FamilyName").Value
    End If
rsdb.Close
'在界面上显示选定的记录
Me.DTPicker1.Value = DataGrid_Income.Columns(1).Text
Me.Combo1.Text = str
Me.Combo2.Text = Combo2.List(Val(DataGrid_Income.Columns(3).Text) - 1)
Me.Text_Income_money.Text = DataGrid_Income.Columns(4).Text
Me.Text_Income_BZ.Text = DataGrid_Income.Columns(5).Text
End Sub

Private Sub Form_Load()    '窗体装载
Dim rsdb As New ADODB.Recordset
Dim i As Integer
On Error Resume Next
'打开日常收入表并填充表格
Me.Adodc_Income.ConnectionString = "Provider=MSDASQL.1;Persist Security Info=" & _
"False;User ID=" & UID & ";pwd=" & PWD & ";Data Source=" & MyDSN
Adodc_Income.RecordSource = "select DailyIncomeID as 编号," & _
                             "DailyIncomeDate as 收入日期," & _
                             "DailyIncomeName as 收入人员," & _
                             "DailyIncomeType as 收入来源," & _
                             "DailyIncomeNum as 收入金额," & _
                             "DailyIncomeBZ as 备注 from DailyIncome"
Adodc_Income.Refresh
'填充收入来源框
rsdb.Open "select * from IncomeType", RemoteCnn, adOpenStatic, adLockReadOnly, -1
    If rsdb.RecordCount > 0 Then
        If Not rsdb.BOF Then rsdb.MoveFirst
        For i = 1 To rsdb.RecordCount
            Me.Combo2.AddItem rsdb.Fields("IncomeTypeID").Value & ":" & _
            rsdb.Fields("IncomeTypeType").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.Combo1.AddItem rsdb.Fields("FamilyName").Value
            If Not rsdb.EOF Then rsdb.MoveNext
        Next i
    End If
rsdb.Close
End Sub

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -