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

📄 form1.frm

📁 用于家庭收支管理
💻 FRM
📖 第 1 页 / 共 2 页
字号:
         Width           =   810
      End
      Begin VB.TextBox Text3 
         Appearance      =   0  'Flat
         BackColor       =   &H00F7F5F4&
         ForeColor       =   &H00FF0000&
         Height          =   270
         Left            =   1620
         TabIndex        =   6
         Top             =   750
         Width           =   285
      End
      Begin VB.TextBox Text2 
         Appearance      =   0  'Flat
         BackColor       =   &H00F7F5F4&
         ForeColor       =   &H00FF0000&
         Height          =   270
         Left            =   915
         TabIndex        =   5
         Text            =   "Text2"
         Top             =   750
         Width           =   285
      End
      Begin VB.TextBox Text1 
         Appearance      =   0  'Flat
         BackColor       =   &H00F7F5F4&
         ForeColor       =   &H00FF0000&
         Height          =   270
         Left            =   210
         TabIndex        =   4
         Text            =   "Text1"
         Top             =   750
         Width           =   465
      End
      Begin VB.Label Label9 
         AutoSize        =   -1  'True
         BackStyle       =   0  'Transparent
         Caption         =   "备注关健字:"
         ForeColor       =   &H00404000&
         Height          =   180
         Left            =   195
         TabIndex        =   28
         Top             =   1335
         Width           =   990
      End
      Begin VB.Label Label3 
         AutoSize        =   -1  'True
         BackStyle       =   0  'Transparent
         Caption         =   "日"
         ForeColor       =   &H00404000&
         Height          =   180
         Left            =   2100
         TabIndex        =   3
         Top             =   825
         Width           =   180
      End
      Begin VB.Label Label2 
         AutoSize        =   -1  'True
         BackStyle       =   0  'Transparent
         Caption         =   "月"
         ForeColor       =   &H00404000&
         Height          =   180
         Left            =   1410
         TabIndex        =   2
         Top             =   810
         Width           =   180
      End
      Begin VB.Label Label1 
         AutoSize        =   -1  'True
         BackStyle       =   0  'Transparent
         Caption         =   "年"
         ForeColor       =   &H00404000&
         Height          =   180
         Left            =   690
         TabIndex        =   1
         Top             =   810
         Width           =   180
      End
   End
End
Attribute VB_Name = "cxll"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False

Private Sub cbexit_Click()
Unload cxll

End Sub

Private Sub cbshuaxin_Click()
Dim shzh As String
Dim rq As String
Dim rqx As String
Dim yzn As String
Dim xmlb As String
Dim sumsh As Currency
Dim sumzh As Currency
Dim mxbzh As String
sumsh = 0
sumzh = 0

If Check1.Value = 1 And Check2.Value = 0 Then
   shzh = "and (收支=" & "'收入')"
 Else
    If Check2.Value = 1 And Check1.Value = 0 Then
        shzh = "and (收支=" & "'支出')"
    Else
        shzh = ""
     End If
 End If
 If Check1.Value = 0 And Check2.Value = 0 Then
    xmlb = "and (项目类别=" & "'" & Combo1.Text & "')"
 Else
    xmlb = ""
 End If
If Check3.Value = 0 Then
     yzn = ""
     If Text3.Text = "" Then
         If Text2 = "" Then
             rqx = "(Year(日期)='" & Text1.Text & " ')"   '按年查"
         Else
             rqx = "(Year(日期)='" & Text1.Text & " ') and" & "(month(日期)='" & Text2.Text & " ')"  '按年月
         End If
    Else
        If Text2.Text = "" Then
             rqx = "(Year(日期)='" & Text1.Text & " ') and" & "(day(日期)='" & Text3.Text & " ')" '按年日
        Else
        rq = Text1.Text & "/" & Text2.Text & "/" & Text3.Text
        rqx = "[日期]=cdate(" & "'" & rq & "')"  '按年月日
        End If
    End If
Else
   rqx = ""
   yzn = "[日期]<=cdate(" & "'" & Date & "') and" & " [日期]>=cdate(" & "'" & Date - 7 & "')"
End If
If textbzh.Text = "" Then '按明细关健字
mxbzh = ""
Else
mxbzh = "and (明细备注 like" & "'*" & textbzh.Text & "*')"
End If
Data1.RecordSource = "select * from mingxi where" & rqx & yzn & shzh & xmlb & mxbzh & "order by 日期 asc"
Data1.Refresh
If Text7.Text = "" Then
shouru.Text = 0
zhichu.Text = 0
Text4.Text = 0
  MsgBox "不存在所查记录!", 48, "提示"
 
  Exit Sub
End If

Data1.Recordset.MoveFirst
While Not Data1.Recordset.EOF
    If Text7.Text = "收入" Then
       sumsh = sumsh + Val(Text8.Text)
    Else
       sumzh = sumzh + Val(Text8.Text)
    End If
   Data1.Recordset.MoveNext
   Wend
shouru.Text = sumsh
zhichu.Text = sumzh
Data1.Recordset.MoveLast
If Check3.Value = 0 And Text3.Text = "" And Text2.Text <> "" And Check1.Value = 1 And Check2.Value = 1 And textbzh.Text = "" Then
   Label5.Caption = "本月当前余额:"
   Text4.Text = sumsh - sumzh
   Label8.Visible = True
   Else
       If Check3.Value = 0 And Text3.Text = "" And Text2.Text = "" And Check1.Value = 1 And Check2.Value = 1 And textbzh.Text = "" Then
           Label5.Caption = "本年当前余额:"
           Text4.Text = sumsh - sumzh
           Label8.Visible = True
        Else
           Text4.Text = Data1.Recordset.RecordCount
            Label5.Caption = "记录个数:"
            Label8.Visible = False
        End If

  End If
End Sub

Private Sub Check1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
   If Check1.Value = 1 Or Check2.Value = 1 Then
       Combo1.Enabled = False
    Else
       Combo1.Enabled = True
    End If

End Sub

Private Sub Check2_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Check1.Value = 1 Or Check2.Value = 1 Then
       Combo1.Enabled = False
       
    Else
       Combo1.Enabled = True
    End If
End Sub

Private Sub Check3_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Check3.Value = 1 Then
    Text1.Enabled = False
    Text2.Enabled = False
    Text3.Enabled = False
    Label1.Enabled = False
    Label2.Enabled = False
    Label3.Enabled = False
 Else
    Text1.Enabled = True
    Text2.Enabled = True
    Text3.Enabled = True
    Label2.Enabled = True
    Label1.Enabled = True
    Label3.Enabled = True
 End If
End Sub

Private Sub Command1_Click()
    
End Sub

Private Sub Command2_Click()
End Sub

Private Sub Form_Activate()
Unload frmdj
Unload fxtj
formname = "cxll"
mainfrm.Toolbar1.Buttons(4).Visible = False
mainfrm.Toolbar1.Buttons(2).Visible = True
mainfrm.Toolbar1.Buttons(3).Visible = False
mainfrm.Toolbar1.Buttons(5).Visible = False
mainfrm.Toolbar1.Buttons(6).Visible = False


mainfrm.SB1.Panels(1).Text = "选择和输入查询条件,按“刷新”显示所查询记录,按“离开”返回主程序"
Text1.Text = Year(Date)
Text2.Text = Month(Date)
vs2.Value = Month(Date)
'VS1.Value = Day(Date)
'Text3.SetFocus
mgd1.ColWidth(0) = 1500
mgd1.ColWidth(1) = 800
mgd1.ColWidth(2) = 1500
mgd1.ColWidth(3) = 800
mgd1.ColWidth(4) = 4500
If Check1.Value = 1 Or Check2.Value = 1 Then
       Combo1.Enabled = False
       
    Else
       Combo1.Enabled = True
    End If
Call cbshuaxin_Click
For i = 0 To 1
     For j = 0 To 30
       If szlbsz(i, j) = "" Then
         Exit For
       End If
     Combo1.AddItem szlbsz(i, j)
     Next
     Next
End Sub

Private Sub Form_Load()

 Data1.DatabaseName = App.Path + "\shouzhi.mdb"
    Data1.RecordSource = "mingxi"
Me.Icon = LoadPicture("")
fromname = "cxll"
End Sub

Private Sub Form_Unload(Cancel As Integer)
mainfrm.SB1.Panels(1).Text = ""

End Sub

Private Sub Text1_LostFocus()
If Text1.Text = "" Then
  MsgBox "必须输入“日期”中的“年份”", 48, "提示"
 End If
End Sub

Private Sub Text2_Change()
If Val(Text2) > 12 Or Val(Text2.Text) < 1 Then Text2.Text = ""
If Text2.Text <> "" Then
vs2.Value = Text2.Text
End If
End Sub

Private Sub Text3_Change()
If Val(Text3) > 31 Or Val(Text3.Text) < 1 Then Text3.Text = ""
If Text3.Text <> "" Then
VS1.Value = Text3.Text
End If
End Sub

Private Sub VScroll1_Change()

End Sub

Private Sub VS1_Change()
Text3.Text = VS1.Value
End Sub

Private Sub vs2_Change()
Text2.Text = vs2.Value

End Sub

⌨️ 快捷键说明

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