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

📄 frmkemu.frm

📁 财务管理信息系统
💻 FRM
📖 第 1 页 / 共 2 页
字号:
         EndProperty
         BeginProperty Button2 {66833FEA-8583-11D1-B16A-00C0F0283628} 
            Caption         =   "上记录"
            Key             =   "btnBefore"
            ImageIndex      =   2
         EndProperty
         BeginProperty Button3 {66833FEA-8583-11D1-B16A-00C0F0283628} 
            Caption         =   "下记录"
            Key             =   "btnNext"
            ImageIndex      =   3
         EndProperty
         BeginProperty Button4 {66833FEA-8583-11D1-B16A-00C0F0283628} 
            Caption         =   "尾记录"
            Key             =   "btnLast"
            ImageIndex      =   4
         EndProperty
         BeginProperty Button5 {66833FEA-8583-11D1-B16A-00C0F0283628} 
            Caption         =   "新增"
            Key             =   "btnNew"
            ImageIndex      =   5
         EndProperty
         BeginProperty Button6 {66833FEA-8583-11D1-B16A-00C0F0283628} 
            Caption         =   "修改"
            Key             =   "btnModify"
            ImageIndex      =   6
         EndProperty
         BeginProperty Button7 {66833FEA-8583-11D1-B16A-00C0F0283628} 
            Caption         =   "删除"
            Key             =   "btnDelete"
            ImageIndex      =   7
         EndProperty
         BeginProperty Button8 {66833FEA-8583-11D1-B16A-00C0F0283628} 
            Enabled         =   0   'False
            Caption         =   "保存"
            Key             =   "btnSave"
            ImageIndex      =   8
         EndProperty
         BeginProperty Button9 {66833FEA-8583-11D1-B16A-00C0F0283628} 
            Enabled         =   0   'False
            Caption         =   "取消"
            Key             =   "btnCancel"
            ImageIndex      =   9
         EndProperty
         BeginProperty Button10 {66833FEA-8583-11D1-B16A-00C0F0283628} 
            Caption         =   "退出"
            Key             =   "btnExit"
            ImageIndex      =   10
         EndProperty
      EndProperty
      Begin MSComctlLib.ImageList ImageList1 
         Left            =   7440
         Top             =   0
         _ExtentX        =   1005
         _ExtentY        =   1005
         BackColor       =   -2147483643
         ImageWidth      =   16
         ImageHeight     =   16
         MaskColor       =   12632256
         _Version        =   393216
         BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628} 
            NumListImages   =   10
            BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628} 
               Picture         =   "frmKeMu.frx":045B
               Key             =   ""
            EndProperty
            BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628} 
               Picture         =   "frmKeMu.frx":056D
               Key             =   ""
            EndProperty
            BeginProperty ListImage3 {2C247F27-8591-11D1-B16A-00C0F0283628} 
               Picture         =   "frmKeMu.frx":067F
               Key             =   ""
            EndProperty
            BeginProperty ListImage4 {2C247F27-8591-11D1-B16A-00C0F0283628} 
               Picture         =   "frmKeMu.frx":0791
               Key             =   ""
            EndProperty
            BeginProperty ListImage5 {2C247F27-8591-11D1-B16A-00C0F0283628} 
               Picture         =   "frmKeMu.frx":08A3
               Key             =   ""
            EndProperty
            BeginProperty ListImage6 {2C247F27-8591-11D1-B16A-00C0F0283628} 
               Picture         =   "frmKeMu.frx":09B5
               Key             =   ""
            EndProperty
            BeginProperty ListImage7 {2C247F27-8591-11D1-B16A-00C0F0283628} 
               Picture         =   "frmKeMu.frx":0AC7
               Key             =   ""
            EndProperty
            BeginProperty ListImage8 {2C247F27-8591-11D1-B16A-00C0F0283628} 
               Picture         =   "frmKeMu.frx":0BD9
               Key             =   ""
            EndProperty
            BeginProperty ListImage9 {2C247F27-8591-11D1-B16A-00C0F0283628} 
               Picture         =   "frmKeMu.frx":0CEB
               Key             =   ""
            EndProperty
            BeginProperty ListImage10 {2C247F27-8591-11D1-B16A-00C0F0283628} 
               Picture         =   "frmKeMu.frx":0DFD
               Key             =   ""
            EndProperty
         EndProperty
      End
   End
   Begin VB.Label Label8 
      Caption         =   "余额方向"
      Height          =   255
      Left            =   7680
      TabIndex        =   17
      Top             =   2880
      Width           =   855
   End
   Begin VB.Label Label7 
      Caption         =   "科目类别"
      Height          =   255
      Left            =   5880
      TabIndex        =   16
      Top             =   2880
      Width           =   975
   End
   Begin VB.Label Label6 
      Caption         =   "助记码"
      Height          =   255
      Left            =   8280
      TabIndex        =   14
      Top             =   1920
      Width           =   735
   End
   Begin VB.Label Label5 
      Caption         =   "科目类别"
      Height          =   255
      Left            =   6840
      TabIndex        =   12
      Top             =   1920
      Width           =   975
   End
   Begin VB.Label Label4 
      Caption         =   "科目代码"
      Height          =   255
      Left            =   5520
      TabIndex        =   10
      Top             =   1920
      Width           =   975
   End
End
Attribute VB_Name = "frmKeMu"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private bAdd As Boolean

Private Sub btnSearch_Click()
    LoadData
End Sub

Private Sub form_load()
    Dim db As New DataBases
    Adodc1.ConnectionString = db.sConn
    cbbKind.AddItem "资产"
    cbbKind.AddItem "负债"
    cbbKind.AddItem "权益"
    cbbKind.AddItem "成本"
    cbbKind.AddItem "损益"
    cbbDirection.AddItem "借方"
    cbbDirection.AddItem "贷方"
    LoadData
    SetTextBoxState (False)
    SetToolBarState (True)
End Sub

'实现数据的读取和显示
Private Sub LoadData()
    Dim strFilter As String
    If Len(Trim(txbOne.Text)) = 0 Then
        If Len(Trim(txbTwo.Text)) = 0 Then
            If Len(Trim(txbThree.Text)) = 0 Then
                strFilter = ""
            Else
                strFilter = "where 科目类别 like '"
                strFilter = strFilter + Trim(txbThree.Text) + "%'"
            End If
        Else
            strFilter = "where 科目名称 like '" + Trim(txbTwo.Text) + "%'"
            If Len(Trim(txbThree.Text)) <> 0 Then
                strFilter = strFilter + " and 科目类别 like '"
                strFilter = strFilter + Trim(txbThree.Text) + "%'"
            End If
        End If
    Else
        strFilter = "where 科目代码 like '" + Trim(txbOne.Text) + "%'"
        If Len(Trim(txbTwo.Text)) <> 0 Then
            strFilter = strFilter + " and 科目名称 like '" + Trim(txbTwo.Text) + "%'"
            If Len(Trim(txbThree.Text)) <> 0 Then
                strFilter = strFilter + " and 科目类别 like '"
                strFilter = strFilter + Trim(txbThree.Text) + "%'"
            End If
        Else
            If Len(Trim(txbThree.Text)) <> 0 Then
                strFilter = strFilter + " and 科目类别 like '"
                strFilter = strFilter + Trim(txbThree.Text) + "%'"
            End If
        End If
    End If
    Dim db As New DataBases
    Dim rs As Recordset
    Set rs = db.RunSelectSQLUpdatable("select * from 科目表  " + strFilter)
    Set Adodc1.Recordset = rs
End Sub

'该函数是用来设置输入框中按钮的状态,当按下新增或修改按钮时,状态改变
Private Sub SetTextBoxState(ByVal bState As Boolean)
    Me.txbCode.Enabled = bState
    Me.txbHelpCode.Enabled = bState
    Me.txbName.Enabled = bState
    Me.cbbDirection.Enabled = bState
    Me.cbbKind.Enabled = bState
End Sub

'该函数是用来设置Toolbar中按钮的状态,当按下新增或修改按钮时,状态改变
Private Sub SetToolBarState(ByVal bState As Boolean)
    '设置Button的是否能够单击
    Toolbar1.Buttons("btnFirst").Enabled = bState
    Toolbar1.Buttons("btnBefore").Enabled = bState
    Toolbar1.Buttons("btnNext").Enabled = bState
    Toolbar1.Buttons("btnLast").Enabled = bState
    Toolbar1.Buttons("btnNew").Enabled = bState
    Toolbar1.Buttons("btnModify").Enabled = bState
    Toolbar1.Buttons("btnDelete").Enabled = bState
    Toolbar1.Buttons("btnSave").Enabled = Not bState
    Toolbar1.Buttons("btnCancel").Enabled = Not bState
    grdDataGrid.Enabled = bState
End Sub

'清空输入窗口
Private Sub Clear()
    Me.txbCode.Text = ""
    Me.txbHelpCode.Text = ""
    Me.txbName.Text = ""
End Sub

'实现修改功能
Private Sub SaveForUpdate()
    Adodc1.Recordset.UpdateBatch adAffectAll
End Sub

'实现删除功能
Private Sub DeleteData()
    Adodc1.Recordset.Delete adAffectCurrent
    Adodc1.Recordset.UpdateBatch
End Sub

'实现增加功能
Private Sub SaveForAdd()
    Dim db As New DataBases
    Dim strSQL As String
    strSQL = "insert into 科目表(科目代码,科目名称,助记码,科目类别,余额方向) values ('"
    strSQL = strSQL + Trim(txbCode.Text) + "','"
    strSQL = strSQL + Trim(txbName.Text) + "','"
    strSQL = strSQL + Trim(txbHelpCode.Text) + "','"
    strSQL = strSQL + Trim(cbbKind.Text) + "','"
    strSQL = strSQL + Trim(cbbDirection.Text) + "')"
    db.RunSelectSQL (strSQL)
End Sub

Private Sub Toolbar1_ButtonClick(ByVal Button As MSComctlLib.Button)
    If StrComp(Button.Key, "btnFirst") = 0 Then
        Adodc1.Recordset.MoveFirst
    ElseIf StrComp(Button.Key, "btnBefore") = 0 Then
        Adodc1.Recordset.MovePrevious
    ElseIf StrComp(Button.Key, "btnNext") = 0 Then
        Adodc1.Recordset.MoveNext
    ElseIf StrComp(Button.Key, "btnLast") = 0 Then
        Adodc1.Recordset.MoveLast
    ElseIf StrComp(Button.Key, "btnNew") = 0 Then
        bAdd = True
        Adodc1.Recordset.AddNew
        SetTextBoxState (True)
        SetToolBarState (False)
        Clear
    ElseIf StrComp(Button.Key, "btnModify") = 0 Then
        bAdd = False
        SetTextBoxState (True)
        SetToolBarState (False)
    ElseIf StrComp(Button.Key, "btnDelete") = 0 Then
        If MsgBox("确定要删除吗?", vbYesNo) = vbYes Then
            DeleteData
        End If
    ElseIf StrComp(Button.Key, "btnSave") = 0 Then
        SetTextBoxState (False)
        SetToolBarState (True)
        If bAdd = True Then
            '为新增数据保存
            SaveForAdd
            Adodc1.Recordset.Requery
        Else
            '为更新数据保存
            SaveForUpdate
        End If
    ElseIf StrComp(Button.Key, "btnCancel") = 0 Then
        Adodc1.Recordset.CancelUpdate
        Adodc1.Recordset.Requery
        SetTextBoxState (False)
        SetToolBarState (True)
    ElseIf StrComp(Button.Key, "btnExit") = 0 Then
        Hide
    End If
End Sub

⌨️ 快捷键说明

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