Search.frm
上传用户:tqlouisa
上传日期:2013-04-03
资源大小:742k
文件大小:19k
源码类别:

其他数据库

开发平台:

Visual Basic

  1. VERSION 5.00
  2. Begin VB.Form search 
  3.    BorderStyle     =   1  'Fixed Single
  4.    Caption         =   "员工信息查询"
  5.    ClientHeight    =   3510
  6.    ClientLeft      =   45
  7.    ClientTop       =   330
  8.    ClientWidth     =   7545
  9.    LinkTopic       =   "Form1"
  10.    MaxButton       =   0   'False
  11.    MDIChild        =   -1  'True
  12.    MinButton       =   0   'False
  13.    ScaleHeight     =   3510
  14.    ScaleWidth      =   7545
  15.    Begin VB.Frame FrmBorrow 
  16.       BorderStyle     =   0  'None
  17.       Height          =   3255
  18.       Left            =   0
  19.       TabIndex        =   0
  20.       Top             =   0
  21.       Width           =   7455
  22.       Begin VB.CommandButton cmdSearch 
  23.          Caption         =   "查询"
  24.          Height          =   495
  25.          Left            =   5640
  26.          TabIndex        =   46
  27.          Top             =   120
  28.          Width           =   975
  29.       End
  30.       Begin VB.Frame frameAuthor 
  31.          BorderStyle     =   0  'None
  32.          Height          =   495
  33.          Left            =   1080
  34.          TabIndex        =   40
  35.          Top             =   720
  36.          Width           =   6015
  37.          Begin VB.CheckBox chkName 
  38.             Height          =   255
  39.             Left            =   120
  40.             TabIndex        =   44
  41.             Top             =   120
  42.             Width           =   375
  43.          End
  44.          Begin VB.OptionButton optNameAnd 
  45.             Caption         =   "AND"
  46.             Height          =   255
  47.             Left            =   480
  48.             TabIndex        =   43
  49.             Top             =   120
  50.             Width           =   615
  51.          End
  52.          Begin VB.OptionButton optNameOr 
  53.             Caption         =   "OR"
  54.             Height          =   255
  55.             Left            =   1080
  56.             TabIndex        =   42
  57.             Top             =   120
  58.             Width           =   495
  59.          End
  60.          Begin VB.TextBox txtName 
  61.             Height          =   270
  62.             Left            =   2760
  63.             TabIndex        =   41
  64.             Top             =   120
  65.             Width           =   2895
  66.          End
  67.          Begin VB.Label Label7 
  68.             Caption         =   "姓名:"
  69.             Height          =   255
  70.             Left            =   1680
  71.             TabIndex        =   45
  72.             Top             =   120
  73.             Width           =   735
  74.          End
  75.       End
  76.       Begin VB.Frame framePHouse 
  77.          BorderStyle     =   0  'None
  78.          Caption         =   "n"
  79.          Height          =   375
  80.          Left            =   1080
  81.          TabIndex        =   34
  82.          Top             =   1440
  83.          Width           =   6015
  84.          Begin VB.CheckBox chkBusi 
  85.             Height          =   255
  86.             Left            =   120
  87.             TabIndex        =   38
  88.             Top             =   120
  89.             Width           =   375
  90.          End
  91.          Begin VB.OptionButton optBusiAnd 
  92.             Caption         =   "AND"
  93.             Height          =   255
  94.             Left            =   480
  95.             TabIndex        =   37
  96.             Top             =   120
  97.             Width           =   615
  98.          End
  99.          Begin VB.OptionButton optBusiOr 
  100.             Caption         =   "OR"
  101.             Height          =   255
  102.             Left            =   1080
  103.             TabIndex        =   36
  104.             Top             =   120
  105.             Width           =   495
  106.          End
  107.          Begin VB.TextBox txtBusi 
  108.             Height          =   270
  109.             Left            =   2760
  110.             TabIndex        =   35
  111.             Top             =   120
  112.             Width           =   2895
  113.          End
  114.          Begin VB.Label Label6 
  115.             Caption         =   "职称:"
  116.             Height          =   255
  117.             Left            =   1680
  118.             TabIndex        =   39
  119.             Top             =   120
  120.             Width           =   855
  121.          End
  122.       End
  123.       Begin VB.Frame frameContent 
  124.          BorderStyle     =   0  'None
  125.          Caption         =   "n"
  126.          Height          =   375
  127.          Left            =   1080
  128.          TabIndex        =   28
  129.          Top             =   1800
  130.          Width           =   6015
  131.          Begin VB.CheckBox chkLevel 
  132.             Height          =   255
  133.             Left            =   120
  134.             TabIndex        =   32
  135.             Top             =   120
  136.             Width           =   375
  137.          End
  138.          Begin VB.OptionButton optLevelAnd 
  139.             Caption         =   "AND"
  140.             Height          =   255
  141.             Left            =   480
  142.             TabIndex        =   31
  143.             Top             =   120
  144.             Width           =   615
  145.          End
  146.          Begin VB.OptionButton optLevelOr 
  147.             Caption         =   "OR"
  148.             Height          =   255
  149.             Left            =   1080
  150.             TabIndex        =   30
  151.             Top             =   120
  152.             Width           =   495
  153.          End
  154.          Begin VB.TextBox txtLevel 
  155.             Height          =   270
  156.             Left            =   2760
  157.             TabIndex        =   29
  158.             Top             =   120
  159.             Width           =   2895
  160.          End
  161.          Begin VB.Label Label5 
  162.             Caption         =   "学历:"
  163.             Height          =   375
  164.             Left            =   1680
  165.             TabIndex        =   33
  166.             Top             =   120
  167.             Width           =   615
  168.          End
  169.       End
  170.       Begin VB.Frame Frame3 
  171.          BorderStyle     =   0  'None
  172.          Height          =   1095
  173.          Left            =   1080
  174.          TabIndex        =   9
  175.          Top             =   2160
  176.          Width           =   7695
  177.          Begin VB.TextBox txtMonKeyFore 
  178.             Height          =   270
  179.             Left            =   3720
  180.             TabIndex        =   24
  181.             Top             =   120
  182.             Width           =   375
  183.          End
  184.          Begin VB.CheckBox chkTimeKey 
  185.             Height          =   255
  186.             Left            =   120
  187.             TabIndex        =   23
  188.             Top             =   120
  189.             Width           =   375
  190.          End
  191.          Begin VB.OptionButton optnTimeand 
  192.             Caption         =   "AND"
  193.             Height          =   255
  194.             Left            =   480
  195.             TabIndex        =   22
  196.             Top             =   120
  197.             Width           =   615
  198.          End
  199.          Begin VB.OptionButton optnTimeor 
  200.             Caption         =   "OR"
  201.             Height          =   255
  202.             Left            =   1080
  203.             TabIndex        =   21
  204.             Top             =   120
  205.             Width           =   495
  206.          End
  207.          Begin VB.TextBox txtYearKeyFore 
  208.             Height          =   270
  209.             Left            =   2760
  210.             TabIndex        =   20
  211.             Top             =   120
  212.             Width           =   735
  213.          End
  214.          Begin VB.Frame Frame2 
  215.             BorderStyle     =   0  'None
  216.             Height          =   375
  217.             Left            =   2760
  218.             TabIndex        =   16
  219.             Top             =   480
  220.             Width           =   3135
  221.             Begin VB.OptionButton optnKeyFore 
  222.                Caption         =   "之前"
  223.                Height          =   255
  224.                Left            =   120
  225.                TabIndex        =   19
  226.                Top             =   120
  227.                Width           =   735
  228.             End
  229.             Begin VB.OptionButton optnKeyBack 
  230.                Caption         =   "之后"
  231.                Height          =   255
  232.                Left            =   840
  233.                TabIndex        =   18
  234.                Top             =   120
  235.                Width           =   735
  236.             End
  237.             Begin VB.OptionButton optnKeyBetween 
  238.                Caption         =   "之间"
  239.                Height          =   255
  240.                Left            =   1920
  241.                TabIndex        =   17
  242.                Top             =   120
  243.                Width           =   735
  244.             End
  245.          End
  246.          Begin VB.Frame frmttime 
  247.             BorderStyle     =   0  'None
  248.             Height          =   495
  249.             Left            =   4320
  250.             TabIndex        =   10
  251.             Top             =   0
  252.             Visible         =   0   'False
  253.             Width           =   2055
  254.             Begin VB.TextBox txtYearKeyBack 
  255.                Height          =   270
  256.                Left            =   240
  257.                TabIndex        =   12
  258.                Top             =   120
  259.                Width           =   735
  260.             End
  261.             Begin VB.TextBox txtMonKeyBack 
  262.                Height          =   270
  263.                Left            =   1320
  264.                TabIndex        =   11
  265.                Top             =   120
  266.                Width           =   375
  267.             End
  268.             Begin VB.Label Label14 
  269.                Caption         =   "至"
  270.                ForeColor       =   &H000000FF&
  271.                Height          =   255
  272.                Left            =   0
  273.                TabIndex        =   15
  274.                Top             =   240
  275.                Width           =   255
  276.             End
  277.             Begin VB.Label Label15 
  278.                Caption         =   "年"
  279.                Height          =   375
  280.                Left            =   1080
  281.                TabIndex        =   14
  282.                Top             =   240
  283.                Width           =   255
  284.             End
  285.             Begin VB.Label Label16 
  286.                Caption         =   "月"
  287.                Height          =   255
  288.                Left            =   1800
  289.                TabIndex        =   13
  290.                Top             =   240
  291.                Width           =   255
  292.             End
  293.          End
  294.          Begin VB.Label Label9 
  295.             Caption         =   "月"
  296.             Height          =   255
  297.             Left            =   4080
  298.             TabIndex        =   27
  299.             Top             =   240
  300.             Width           =   255
  301.          End
  302.          Begin VB.Label Label8 
  303.             Caption         =   "年"
  304.             Height          =   255
  305.             Left            =   3480
  306.             TabIndex        =   26
  307.             Top             =   240
  308.             Width           =   255
  309.          End
  310.          Begin VB.Label Label3 
  311.             Caption         =   "进入时间:"
  312.             Height          =   255
  313.             Left            =   1680
  314.             TabIndex        =   25
  315.             Top             =   120
  316.             Width           =   1095
  317.          End
  318.       End
  319.       Begin VB.Frame frameBookName 
  320.          BorderStyle     =   0  'None
  321.          Height          =   495
  322.          Left            =   1080
  323.          TabIndex        =   3
  324.          Top             =   1080
  325.          Width           =   6015
  326.          Begin VB.TextBox txtDept 
  327.             Height          =   270
  328.             Left            =   2760
  329.             TabIndex        =   7
  330.             Top             =   120
  331.             Width           =   2895
  332.          End
  333.          Begin VB.OptionButton optDeptOr 
  334.             Caption         =   "OR"
  335.             Height          =   255
  336.             Left            =   1080
  337.             TabIndex        =   6
  338.             Top             =   120
  339.             Width           =   495
  340.          End
  341.          Begin VB.OptionButton optDeptAnd 
  342.             Caption         =   "AND"
  343.             Height          =   255
  344.             Left            =   480
  345.             TabIndex        =   5
  346.             Top             =   120
  347.             Width           =   615
  348.          End
  349.          Begin VB.CheckBox chkDept 
  350.             Height          =   255
  351.             Left            =   120
  352.             TabIndex        =   4
  353.             Top             =   120
  354.             Width           =   375
  355.          End
  356.          Begin VB.Label Label2 
  357.             Caption         =   "部门:"
  358.             Height          =   255
  359.             Left            =   1680
  360.             TabIndex        =   8
  361.             Top             =   120
  362.             Width           =   615
  363.          End
  364.       End
  365.       Begin VB.TextBox txtKey 
  366.          Height          =   270
  367.          Left            =   2760
  368.          TabIndex        =   2
  369.          Top             =   240
  370.          Width           =   1575
  371.       End
  372.       Begin VB.ComboBox cmbItem 
  373.          Height          =   300
  374.          Left            =   1200
  375.          TabIndex        =   1
  376.          Top             =   240
  377.          Width           =   1455
  378.       End
  379.       Begin VB.Label Label10 
  380.          Caption         =   "详细查询条件:"
  381.          Height          =   615
  382.          Left            =   240
  383.          TabIndex        =   48
  384.          Top             =   720
  385.          Width           =   855
  386.       End
  387.       Begin VB.Label Label1 
  388.          Caption         =   "查询条件:"
  389.          Height          =   255
  390.          Left            =   240
  391.          TabIndex        =   47
  392.          Top             =   240
  393.          Width           =   1215
  394.       End
  395.    End
  396. End
  397. Attribute VB_Name = "search"
  398. Attribute VB_GlobalNameSpace = False
  399. Attribute VB_Creatable = False
  400. Attribute VB_PredeclaredId = True
  401. Attribute VB_Exposed = False
  402. Private Sub cmbitem_click()
  403.     Select Case cmbItem.ListIndex
  404.     Case 0
  405.     '"无"
  406.         txtKey.Visible = False
  407.         chkName.Enabled = True
  408.         chkDept.Enabled = True
  409.         chkBusi.Enabled = True
  410.         chkLevel.Enabled = True
  411.    Case 1
  412.     '"姓名"
  413.         txtKey.Visible = True
  414.         chkName.Enabled = False
  415.         chkDept.Enabled = True
  416.         chkBusi.Enabled = True
  417.         chkLevel.Enabled = True
  418.         Case 2
  419.     '"部门"
  420.         txtKey.Visible = True
  421.         chkName.Enabled = True
  422.         chkDept.Enabled = False
  423.         chkBusi.Enabled = True
  424.         chkLevel.Enabled = True
  425.         Case 3
  426.     '"职称"
  427.         txtKey.Visible = True
  428.         chkName.Enabled = True
  429.         chkDept.Enabled = True
  430.         chkBusi.Enabled = False
  431.         chkLevel.Enabled = True
  432.         Case 4
  433.     '"学历"
  434.         txtKey.Visible = True
  435.         chkName.Enabled = True
  436.         chkDept.Enabled = True
  437.         chkBusi.Enabled = True
  438.         chkLevel.Enabled = False
  439.     End Select
  440. End Sub
  441. Private Sub cmdSearch_Click()
  442.     Dim sqltxt As String
  443.     Dim wheretxt As String
  444.     '初始化Sqlstr和Wherestr
  445.     sqltxt = "select * from ManInfo "
  446.     wheretxt = ""
  447.     '判断Combobox选项
  448.     If cmbItem.ListIndex = 0 Then
  449.     '无
  450.     Else
  451.         If txtKey.Text <> "" Then
  452.             Select Case cmbItem.ListIndex
  453.             Case 1
  454.                 '姓名
  455.                 wheretxt = wheretxt + "ygName='" & txtKey & "'"
  456.             Case 2
  457.                 '部门
  458.                 wheretxt = wheretxt + "ygDept='" & txtKey & "'"
  459.             Case 3
  460.                 '职称
  461.                 wheretxt = wheretxt + "ygBusi='" & txtKey & "'"
  462.             Case 4
  463.                 '学历
  464.                 wheretxt = wheretxt + "ygLevel='" & txtKey & "'"
  465.             End Select
  466.         End If
  467.     End If
  468.     '详细条件
  469.     '姓名关键字
  470.     If chkName.Enabled And chkName.Value = 1 And txtName.Text <> "" Then
  471.         If wherestr <> "" Then
  472.             If optNameAnd.Value Then
  473.                 wheretxt = wheretxt + " and "
  474.             Else
  475.                 wheretxt = wheretxt + " or "
  476.             End If
  477.         End If
  478.         wheretxt = wheretxt + "ygName like '%" & txtName & "%'"
  479.     End If
  480.     '部门关键字
  481.     If chkDept.Enabled And chkDept.Value = 1 And txtDept.Text <> "" Then
  482.         If wheretxt <> "" Then
  483.             If optDeptAnd.Value Then
  484.                 wheretxt = wheretxt + " and "
  485.             Else
  486.                 wheretxt = wheretxt + " or  "
  487.             End If
  488.         End If
  489.         wheretxt = wheretxt + "ygDept like '%" & txtDept & "%'"
  490.     End If
  491.     '职称关键字
  492.     If chkBusi.Enabled And chkBusi.Value = 1 And txtBusi.Text <> "" Then
  493.         If wheretxt <> "" Then
  494.             If optBusiAnd.Value Then
  495.                 wheretxt = wheretxt + " and "
  496.             Else
  497.                 wheretxt = wheretxt + " or "
  498.             End If
  499.         End If
  500.         wheretxt = wheretxt + "ygBusi like '%" & txtBusi & "%'"
  501.     End If
  502.     '学历关键字
  503.     If chkLevel.Enabled And chkLevel.Value = 1 And txtLevel.Text <> "" Then
  504.         If wheretxt <> "" Then
  505.             If optLevelAnd.Value Then
  506.                 wheretxt = wheretxt + " and "
  507.             Else
  508.                 wheretxt = wheretxt + " or "
  509.             End If
  510.         End If
  511.         wheretxt = wheretxt + "ygLevel like '%" & txtLevel & "%'"
  512.     End If
  513.    
  514.     '进入时间
  515.     If chkTimeKey.Enabled And chkTimeKey.Value = 1 Then
  516.         If optnKeyFore.Value Or optnKeyBack.Value Then
  517.             If txtYearKeyFore.Text = "" Or txtMonKeyFore.Text = "" Then
  518.                 MsgBox "请完整填写查询时间!", vbOKOnly + vbInformation, "查询"
  519.                 Exit Sub
  520.             End If
  521.             If wheretxt <> "" Then
  522.                 If optnTimeand.Value Then
  523.                     wheretxt = wheretxt + " and "
  524.                 Else
  525.                     wheretxt = wheretxt + " or "
  526.                 End If
  527.             End If
  528.         '之前
  529.             If optnKeyFore.Value Then
  530.                 wheretxt = wheretxt + "ygDate4<'" & txtYearKeyFore.Text + "-" + txtMonKeyFore.Text & "'"
  531.         '之后
  532.             ElseIf optnKeyBack.Value Then
  533.                 wheretxt = wheretxt + "ygDate4>'" & txtYearKeyFore.Text + "-" + txtMonKeyFore.Text & "'"
  534.             End If
  535.         ElseIf optnKeyBetween.Value Then
  536.             If txtYearKeyFore.Text = "" Or txtMonKeyFore.Text = "" Or txtYearKeyBack.Text = "" Or txtMonKeyBack.Text = "" Then
  537.                 MsgBox "请完整填写查询时间", vbOKOnly + vbInformation, "查询"
  538.                 Exit Sub
  539.             End If
  540.             If wheretxt <> "" Then
  541.                 If optnTimeand.Value Then
  542.                     wheretxt = wheretxt + " and "
  543.                 Else
  544.                     wheretxt = wheretxt + " or "
  545.                 End If
  546.             End If
  547.         '之间
  548.             wheretxt = wheretxt + "ygDate4 between '" & txtYearKeyFore.Text + "-" + txtMonKeyFore.Text & "'and '" & txtYearKeyBack.Text + "-" + txtMonKeyBack.Text & "'"
  549.         End If
  550.     End If
  551.     '综合所有条件
  552.     If wheretxt <> "" Then
  553.         wheretxt = "where " + wheretxt
  554.     End If
  555.     flagSearch = True
  556.     sql = sqltxt + wheretxt
  557.     frmManrecord1.ShowTitle
  558.     frmManrecord1.ShowData
  559.     frmManrecord1.Show
  560.     frmManrecord1.ZOrder 0
  561. End Sub
  562. Private Sub Form_Load()
  563.     cmbItem.AddItem "无"
  564.     cmbItem.AddItem "姓名"
  565.     cmbItem.AddItem "部门"
  566.     cmbItem.AddItem "职称"
  567.     cmbItem.AddItem "学历"
  568.     cmbItem.ListIndex = 0
  569. End Sub
  570. Private Sub optnKeyBack_Click()
  571.      frmttime.Visible = False
  572. End Sub
  573. Private Sub optnKeyBetween_Click()
  574.      frmttime.Visible = True
  575. End Sub
  576. Private Sub optnKeyFore_Click()
  577.      frmttime.Visible = False
  578. End Sub