frm_query.frm
上传用户:xxdyjx888
上传日期:2022-06-01
资源大小:55k
文件大小:18k
源码类别:

家庭/个人应用

开发平台:

Visual Basic

  1. VERSION 5.00
  2. Object = "{BDC217C8-ED16-11CD-956C-0000C04E4C0A}#1.1#0"; "TABCTL32.OCX"
  3. Object = "{86CF1D34-0C5F-11D2-A9FC-0000F8754DA1}#2.0#0"; "mscomct2.ocx"
  4. Object = "{0ECD9B60-23AA-11D0-B351-00A0C9055D8E}#6.0#0"; "MSHFLXGD.OCX"
  5. Begin VB.Form frm_query 
  6.    Caption         =   "查询"
  7.    ClientHeight    =   6585
  8.    ClientLeft      =   60
  9.    ClientTop       =   345
  10.    ClientWidth     =   7305
  11.    Icon            =   "frm_query.frx":0000
  12.    LinkTopic       =   "Form1"
  13.    MaxButton       =   0   'False
  14.    ScaleHeight     =   6585
  15.    ScaleWidth      =   7305
  16.    StartUpPosition =   2  'CenterScreen
  17.    Begin TabDlg.SSTab SSTab1 
  18.       Height          =   6615
  19.       Left            =   0
  20.       TabIndex        =   0
  21.       Top             =   0
  22.       Width           =   7335
  23.       _ExtentX        =   12938
  24.       _ExtentY        =   11668
  25.       _Version        =   393216
  26.       Tabs            =   2
  27.       TabHeight       =   520
  28.       TabCaption(0)   =   "日常收入"
  29.       TabPicture(0)   =   "frm_query.frx":030A
  30.       Tab(0).ControlEnabled=   -1  'True
  31.       Tab(0).Control(0)=   "Label3"
  32.       Tab(0).Control(0).Enabled=   0   'False
  33.       Tab(0).Control(1)=   "Label1"
  34.       Tab(0).Control(1).Enabled=   0   'False
  35.       Tab(0).Control(2)=   "Label2"
  36.       Tab(0).Control(2).Enabled=   0   'False
  37.       Tab(0).Control(3)=   "DTPicker1"
  38.       Tab(0).Control(3).Enabled=   0   'False
  39.       Tab(0).Control(4)=   "Combo2"
  40.       Tab(0).Control(4).Enabled=   0   'False
  41.       Tab(0).Control(5)=   "Combo1"
  42.       Tab(0).Control(5).Enabled=   0   'False
  43.       Tab(0).Control(6)=   "Chk_project"
  44.       Tab(0).Control(6).Enabled=   0   'False
  45.       Tab(0).Control(7)=   "Chk_money"
  46.       Tab(0).Control(7).Enabled=   0   'False
  47.       Tab(0).Control(8)=   "Chk_mode"
  48.       Tab(0).Control(8).Enabled=   0   'False
  49.       Tab(0).Control(9)=   "Chk_date"
  50.       Tab(0).Control(9).Enabled=   0   'False
  51.       Tab(0).Control(10)=   "Command1"
  52.       Tab(0).Control(10).Enabled=   0   'False
  53.       Tab(0).Control(11)=   "Command2"
  54.       Tab(0).Control(11).Enabled=   0   'False
  55.       Tab(0).Control(12)=   "MSHFlexGrid1"
  56.       Tab(0).Control(12).Enabled=   0   'False
  57.       Tab(0).Control(13)=   "DTPicker2"
  58.       Tab(0).Control(13).Enabled=   0   'False
  59.       Tab(0).Control(14)=   "txt_money"
  60.       Tab(0).Control(14).Enabled=   0   'False
  61.       Tab(0).ControlCount=   15
  62.       TabCaption(1)   =   "日常支出"
  63.       TabPicture(1)   =   "frm_query.frx":0326
  64.       Tab(1).ControlEnabled=   0   'False
  65.       Tab(1).Control(0)=   "MSHFlexGrid2"
  66.       Tab(1).Control(1)=   "Combo3"
  67.       Tab(1).Control(2)=   "Chk_project1"
  68.       Tab(1).Control(3)=   "Command4"
  69.       Tab(1).Control(4)=   "Command3"
  70.       Tab(1).Control(5)=   "Chk_date1"
  71.       Tab(1).Control(6)=   "Chk_mode1"
  72.       Tab(1).Control(7)=   "Chk_money1"
  73.       Tab(1).Control(8)=   "Combo4"
  74.       Tab(1).Control(9)=   "txt_money1"
  75.       Tab(1).Control(10)=   "DTPicker3"
  76.       Tab(1).Control(11)=   "DTPicker4"
  77.       Tab(1).Control(12)=   "Label6"
  78.       Tab(1).Control(13)=   "Label5"
  79.       Tab(1).Control(14)=   "Label4"
  80.       Tab(1).ControlCount=   15
  81.       Begin VB.TextBox txt_money 
  82.          Height          =   300
  83.          Left            =   2280
  84.          TabIndex        =   30
  85.          Top             =   2040
  86.          Width           =   1335
  87.       End
  88.       Begin MSComCtl2.DTPicker DTPicker2 
  89.          Height          =   300
  90.          Left            =   3960
  91.          TabIndex        =   29
  92.          Top             =   600
  93.          Width           =   1335
  94.          _ExtentX        =   2355
  95.          _ExtentY        =   529
  96.          _Version        =   393216
  97.          Format          =   64487425
  98.          CurrentDate     =   37807
  99.       End
  100.       Begin MSHierarchicalFlexGridLib.MSHFlexGrid MSHFlexGrid1 
  101.          Height          =   2535
  102.          Left            =   120
  103.          TabIndex        =   28
  104.          Top             =   3240
  105.          Width           =   7095
  106.          _ExtentX        =   12515
  107.          _ExtentY        =   4471
  108.          _Version        =   393216
  109.          _NumberOfBands  =   1
  110.          _Band(0).Cols   =   2
  111.       End
  112.       Begin MSHierarchicalFlexGridLib.MSHFlexGrid MSHFlexGrid2 
  113.          Height          =   2535
  114.          Left            =   -74880
  115.          TabIndex        =   27
  116.          Top             =   3240
  117.          Width           =   7095
  118.          _ExtentX        =   12515
  119.          _ExtentY        =   4471
  120.          _Version        =   393216
  121.          AllowUserResizing=   1
  122.          _NumberOfBands  =   1
  123.          _Band(0).Cols   =   2
  124.       End
  125.       Begin VB.ComboBox Combo3 
  126.          Height          =   315
  127.          ItemData        =   "frm_query.frx":0342
  128.          Left            =   -72720
  129.          List            =   "frm_query.frx":0349
  130.          Style           =   2  'Dropdown List
  131.          TabIndex        =   26
  132.          Top             =   1320
  133.          Width           =   1335
  134.       End
  135.       Begin VB.CheckBox Chk_project1 
  136.          Caption         =   "按项目"
  137.          Height          =   255
  138.          Left            =   -74640
  139.          TabIndex        =   25
  140.          Top             =   2760
  141.          Width           =   1455
  142.       End
  143.       Begin VB.CommandButton Command4 
  144.          Caption         =   "关闭"
  145.          Height          =   375
  146.          Left            =   -71400
  147.          TabIndex        =   24
  148.          Top             =   6000
  149.          Width           =   735
  150.       End
  151.       Begin VB.CommandButton Command3 
  152.          Caption         =   "查询"
  153.          Height          =   375
  154.          Left            =   -72120
  155.          TabIndex        =   23
  156.          Top             =   6000
  157.          Width           =   735
  158.       End
  159.       Begin VB.CommandButton Command2 
  160.          Caption         =   "关闭"
  161.          Height          =   375
  162.          Left            =   3600
  163.          TabIndex        =   22
  164.          Top             =   6000
  165.          Width           =   735
  166.       End
  167.       Begin VB.CommandButton Command1 
  168.          Caption         =   "查询"
  169.          Height          =   375
  170.          Left            =   2880
  171.          TabIndex        =   21
  172.          Top             =   6000
  173.          Width           =   735
  174.       End
  175.       Begin VB.CheckBox Chk_date1 
  176.          Caption         =   "按日期"
  177.          Height          =   255
  178.          Left            =   -74640
  179.          TabIndex        =   17
  180.          Top             =   600
  181.          Width           =   975
  182.       End
  183.       Begin VB.CheckBox Chk_mode1 
  184.          Caption         =   "按方式"
  185.          Height          =   255
  186.          Left            =   -74640
  187.          TabIndex        =   14
  188.          Top             =   1320
  189.          Width           =   1335
  190.       End
  191.       Begin VB.CheckBox Chk_money1 
  192.          Caption         =   "按金额"
  193.          Height          =   255
  194.          Left            =   -74640
  195.          TabIndex        =   13
  196.          Top             =   2040
  197.          Width           =   1335
  198.       End
  199.       Begin VB.ComboBox Combo4 
  200.          Height          =   315
  201.          Left            =   -72720
  202.          Style           =   2  'Dropdown List
  203.          TabIndex        =   12
  204.          Top             =   2760
  205.          Width           =   1335
  206.       End
  207.       Begin VB.TextBox txt_money1 
  208.          Height          =   300
  209.          Left            =   -72720
  210.          TabIndex        =   11
  211.          Top             =   2040
  212.          Width           =   1335
  213.       End
  214.       Begin VB.CheckBox Chk_date 
  215.          Caption         =   "按日期"
  216.          Height          =   255
  217.          Left            =   360
  218.          TabIndex        =   8
  219.          Top             =   600
  220.          Width           =   975
  221.       End
  222.       Begin VB.CheckBox Chk_mode 
  223.          Caption         =   "按方式"
  224.          Height          =   255
  225.          Left            =   360
  226.          TabIndex        =   5
  227.          Top             =   1320
  228.          Width           =   1335
  229.       End
  230.       Begin VB.CheckBox Chk_money 
  231.          Caption         =   "按金额"
  232.          Height          =   255
  233.          Left            =   360
  234.          TabIndex        =   4
  235.          Top             =   2040
  236.          Width           =   1335
  237.       End
  238.       Begin VB.CheckBox Chk_project 
  239.          Caption         =   "按项目"
  240.          Height          =   255
  241.          Left            =   360
  242.          TabIndex        =   3
  243.          Top             =   2760
  244.          Width           =   1455
  245.       End
  246.       Begin VB.ComboBox Combo1 
  247.          Height          =   315
  248.          ItemData        =   "frm_query.frx":0353
  249.          Left            =   2280
  250.          List            =   "frm_query.frx":035A
  251.          Style           =   2  'Dropdown List
  252.          TabIndex        =   2
  253.          Top             =   1320
  254.          Width           =   1335
  255.       End
  256.       Begin VB.ComboBox Combo2 
  257.          Height          =   315
  258.          Left            =   2280
  259.          Style           =   2  'Dropdown List
  260.          TabIndex        =   1
  261.          Top             =   2760
  262.          Width           =   1335
  263.       End
  264.       Begin MSComCtl2.DTPicker DTPicker1 
  265.          Height          =   300
  266.          Left            =   2280
  267.          TabIndex        =   7
  268.          Top             =   600
  269.          Width           =   1335
  270.          _ExtentX        =   2355
  271.          _ExtentY        =   529
  272.          _Version        =   393216
  273.          Format          =   64487425
  274.          CurrentDate     =   37836
  275.       End
  276.       Begin MSComCtl2.DTPicker DTPicker3 
  277.          Height          =   300
  278.          Left            =   -72720
  279.          TabIndex        =   15
  280.          Top             =   600
  281.          Width           =   1335
  282.          _ExtentX        =   2355
  283.          _ExtentY        =   529
  284.          _Version        =   393216
  285.          Format          =   64487425
  286.          CurrentDate     =   37836
  287.       End
  288.       Begin MSComCtl2.DTPicker DTPicker4 
  289.          Height          =   300
  290.          Left            =   -71040
  291.          TabIndex        =   16
  292.          Top             =   600
  293.          Width           =   1335
  294.          _ExtentX        =   2355
  295.          _ExtentY        =   529
  296.          _Version        =   393216
  297.          Format          =   64487425
  298.          CurrentDate     =   37836
  299.       End
  300.       Begin VB.Label Label6 
  301.          Caption         =   "元"
  302.          Height          =   255
  303.          Left            =   -71280
  304.          TabIndex        =   20
  305.          Top             =   2040
  306.          Width           =   255
  307.       End
  308.       Begin VB.Label Label5 
  309.          Caption         =   "到"
  310.          Height          =   255
  311.          Left            =   -71280
  312.          TabIndex        =   19
  313.          Top             =   600
  314.          Width           =   255
  315.       End
  316.       Begin VB.Label Label4 
  317.          Caption         =   "从"
  318.          Height          =   255
  319.          Left            =   -72960
  320.          TabIndex        =   18
  321.          Top             =   600
  322.          Width           =   375
  323.       End
  324.       Begin VB.Label Label2 
  325.          Caption         =   "到"
  326.          Height          =   255
  327.          Left            =   3720
  328.          TabIndex        =   10
  329.          Top             =   600
  330.          Width           =   255
  331.       End
  332.       Begin VB.Label Label1 
  333.          Caption         =   "从"
  334.          Height          =   255
  335.          Left            =   2040
  336.          TabIndex        =   9
  337.          Top             =   600
  338.          Width           =   375
  339.       End
  340.       Begin VB.Label Label3 
  341.          Caption         =   "元"
  342.          Height          =   255
  343.          Left            =   3720
  344.          TabIndex        =   6
  345.          Top             =   2040
  346.          Width           =   375
  347.       End
  348.    End
  349. End
  350. Attribute VB_Name = "frm_query"
  351. Attribute VB_GlobalNameSpace = False
  352. Attribute VB_Creatable = False
  353. Attribute VB_PredeclaredId = True
  354. Attribute VB_Exposed = False
  355. Dim Mydb As New ADODB.Recordset
  356. Dim Mydb1 As New ADODB.Recordset
  357. Dim Mydb2 As New ADODB.Recordset
  358. Dim Mydb3 As New ADODB.Recordset
  359. Dim Mydb4 As New ADODB.Recordset
  360. Dim Mydb5 As New ADODB.Recordset
  361. Dim Mydb10 As New ADODB.Recordset
  362. Dim Mydb11 As New ADODB.Recordset
  363. Dim Mydb12 As New ADODB.Recordset
  364. Dim Str_text As String
  365. Dim Riqi, Riqi1, Riqi3, Riqi4
  366. Private Sub Chk_date1_Click()
  367.             If Chk_date1.Value = 1 Then
  368.                Chk_mode1.Value = 0
  369.                Chk_money1.Value = 0
  370.                Chk_project1.Value = 0
  371.             End If
  372. End Sub
  373. Private Sub Chk_mode1_Click()
  374.             If Chk_mode1.Value = 1 Then
  375.                Chk_money1.Value = 0
  376.                Chk_project1.Value = 0
  377.                Chk_date1.Value = 0
  378.             End If
  379.                
  380. End Sub
  381. Private Sub Chk_money1_Click()
  382.             If Chk_money1.Value = 1 Then
  383.                Chk_mode1.Value = 0
  384.                Chk_project1.Value = 0
  385.                Chk_date1.Value = 0
  386.             End If
  387. End Sub
  388. Private Sub Chk_project1_Click()
  389.             If Chk_project1.Value = 1 Then
  390.                Chk_mode1.Value = 0
  391.                Chk_date1.Value = 0
  392.                Chk_money1.Value = 0
  393.             End If
  394. End Sub
  395. Private Sub Command1_Click()
  396.             If Chk_date.Value = 1 Then
  397.                Call Criqi
  398.             End If
  399.             If Chk_mode.Value = 1 Then
  400.                Call Mode
  401.             End If
  402.             If Chk_money = 1 Then
  403.                Call Money
  404.             End If
  405.             If Chk_project.Value = 1 Then
  406.                Call Project
  407.             End If
  408. End Sub
  409. Private Sub Command2_Click()
  410.             Unload Me
  411. End Sub
  412. Private Sub Command3_Click()
  413.             If Chk_date1.Value = 1 Then
  414.                Call Criqi1
  415.             End If
  416.             If Chk_mode1.Value = 1 Then
  417.                Call Mode1
  418.             End If
  419.             If Chk_money1 = 1 Then
  420.                Call Money1
  421.             End If
  422.             If Chk_project1.Value = 1 Then
  423.                Call Project1
  424.             End If
  425. End Sub
  426. Private Sub Command4_Click()
  427.             Unload Me
  428. End Sub
  429. Private Function Criqi()
  430.                  Riqi = Format(DTPicker1.Value, "yyyy-mm-dd")
  431.                  Riqi1 = Format(DTPicker2.Value, "yyyy-mm-dd")
  432.                  
  433.                  Set Mydb = ExeCutesql("select * from 收入 where 日期 between '" & Riqi & "'and '" & Riqi1 & "'", Str_text)
  434.                  Set MSHFlexGrid1.DataSource = Mydb
  435. End Function
  436. Private Function Mode()
  437.                  Set Mydb1 = ExeCutesql("select * from 收入 where 方式='" & Combo1.Text & "'", Str_text)
  438.                  Set MSHFlexGrid1.DataSource = Mydb1
  439. End Function
  440. Private Function Money()
  441.                  On Error Resume Next
  442.                                                 
  443.                  Set Mydb2 = ExeCutesql("select * from 收入 where 金额=" & txt_money.Text, Str_text)
  444.                  Set MSHFlexGrid1.DataSource = Mydb2
  445. End Function
  446. Private Function Project()
  447.                  Set Mydb3 = ExeCutesql("select * from 收入 where 项目='" & Combo2.Text & "'", Str_text)
  448.                  Set MSHFlexGrid1.DataSource = Mydb3
  449. End Function
  450. Private Sub Form_Load()
  451.             On Error Resume Next
  452.             Dim A, B
  453.             
  454.             Set Mydb4 = ExeCutesql("select * from 收入项目", Str_text)
  455.             A = Mydb4.RecordCount
  456.             For I = 1 To A
  457.                 Combo2.AddItem Mydb4.Fields(0)
  458.                 Mydb4.MoveNext
  459.                 If Mydb4.EOF Then Exit For
  460.             Next I
  461.             
  462.             Set Mydb5 = ExeCutesql("select * from 支出项目", Str_text)
  463.             B = Mydb5.RecordCount
  464.             For I = 1 To B
  465.                 Combo4.AddItem Mydb5.Fields(0)
  466.                 Mydb5.MoveNext
  467.                 If Mydb5.EOF Then Exit For
  468.             Next I
  469.             
  470.             DTPicker1.Value = Date
  471.             DTPicker2.Value = Date
  472.             DTPicker3.Value = Date
  473.             DTPicker4.Value = Date
  474.             
  475. End Sub
  476. Private Function Criqi1()
  477.                  Riqi3 = Format(DTPicker3.Value, "yyyy-mm-dd")
  478.                  Riqi4 = Format(DTPicker4.Value, "yyyy-mm-dd")
  479.                  
  480.                  Set Mydb10 = ExeCutesql("select * from 支出 where 日期 between'" & Riqi3 & "' and '" & Riqi4 & "'", Str_text)
  481.                  Set MSHFlexGrid2.DataSource = Mydb10
  482. End Function
  483. Private Function Mode1()
  484.                  Set Mydb1 = ExeCutesql("select * from 支出 where 方式='" & Combo3.Text & "'", Str_text)
  485.                  Set MSHFlexGrid2.DataSource = Mydb1
  486. End Function
  487. Private Function Money1()
  488.                  On Error Resume Next
  489.                 
  490.                  Set Mydb11 = ExeCutesql("select * from 支出 where 金额=" & txt_money1.Text, Str_text)
  491.                  Set MSHFlexGrid2.DataSource = Mydb11
  492. End Function
  493. Private Function Project1()
  494.                  Set Mydb12 = ExeCutesql("select * from 支出 where 项目='" & Combo4.Text & "'", Str_text)
  495.                  Set MSHFlexGrid2.DataSource = Mydb12
  496. End Function
  497. Private Sub Chk_date_Click()
  498.             If Chk_date.Value = 1 Then
  499.                Chk_mode.Value = 0
  500.                Chk_money.Value = 0
  501.                Chk_project.Value = 0
  502.             End If
  503. End Sub
  504. Private Sub Chk_mode_Click()
  505.             If Chk_mode.Value = 1 Then
  506.                Chk_money.Value = 0
  507.                Chk_project.Value = 0
  508.                Chk_date.Value = 0
  509.             End If
  510.                
  511. End Sub
  512. Private Sub Chk_money_Click()
  513.             If Chk_money.Value = 1 Then
  514.                Chk_mode.Value = 0
  515.                Chk_project.Value = 0
  516.                Chk_date.Value = 0
  517.             End If
  518. End Sub
  519. Private Sub Chk_project_Click()
  520.             If Chk_project.Value = 1 Then
  521.                Chk_mode.Value = 0
  522.                Chk_date.Value = 0
  523.                Chk_money.Value = 0
  524.             End If
  525. End Sub