frmDrivercha.frm
上传用户:naidiweb
上传日期:2013-08-15
资源大小:672k
文件大小:13k
开发平台:

WORD

  1. VERSION 5.00
  2. Object = "{86CF1D34-0C5F-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCT2.OCX"
  3. Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
  4. Object = "{CDE57A40-8B86-11D0-B3C6-00A0C90AEA82}#1.0#0"; "MSDATGRD.OCX"
  5. Begin VB.Form frmDrivercha 
  6.    Caption         =   "驾驶员档案查询"
  7.    ClientHeight    =   4035
  8.    ClientLeft      =   60
  9.    ClientTop       =   345
  10.    ClientWidth     =   7695
  11.    LinkTopic       =   "Form1"
  12.    MDIChild        =   -1  'True
  13.    ScaleHeight     =   4035
  14.    ScaleWidth      =   7695
  15.    Begin VB.Frame Frame2 
  16.       Caption         =   "Frame2"
  17.       Height          =   2265
  18.       Left            =   45
  19.       TabIndex        =   16
  20.       Top             =   1680
  21.       Width           =   7560
  22.       Begin MSAdodcLib.Adodc Adodc1 
  23.          Height          =   735
  24.          Left            =   3585
  25.          Top             =   960
  26.          Visible         =   0   'False
  27.          Width           =   2295
  28.          _ExtentX        =   4048
  29.          _ExtentY        =   1296
  30.          ConnectMode     =   0
  31.          CursorLocation  =   3
  32.          IsolationLevel  =   -1
  33.          ConnectionTimeout=   15
  34.          CommandTimeout  =   30
  35.          CursorType      =   3
  36.          LockType        =   3
  37.          CommandType     =   1
  38.          CursorOptions   =   0
  39.          CacheSize       =   50
  40.          MaxRecords      =   0
  41.          BOFAction       =   0
  42.          EOFAction       =   0
  43.          ConnectStringType=   1
  44.          Appearance      =   1
  45.          BackColor       =   -2147483643
  46.          ForeColor       =   -2147483640
  47.          Orientation     =   0
  48.          Enabled         =   -1
  49.          Connect         =   ""
  50.          OLEDBString     =   ""
  51.          OLEDBFile       =   ""
  52.          DataSourceName  =   ""
  53.          OtherAttributes =   ""
  54.          UserName        =   ""
  55.          Password        =   ""
  56.          RecordSource    =   ""
  57.          Caption         =   "Adodc1"
  58.          BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
  59.             Name            =   "宋体"
  60.             Size            =   9
  61.             Charset         =   134
  62.             Weight          =   400
  63.             Underline       =   0   'False
  64.             Italic          =   0   'False
  65.             Strikethrough   =   0   'False
  66.          EndProperty
  67.          _Version        =   393216
  68.       End
  69.       Begin MSDataGridLib.DataGrid DataGrid1 
  70.          Bindings        =   "frmDrivercha.frx":0000
  71.          Height          =   1935
  72.          Left            =   105
  73.          TabIndex        =   17
  74.          Top             =   210
  75.          Width           =   7320
  76.          _ExtentX        =   12912
  77.          _ExtentY        =   3413
  78.          _Version        =   393216
  79.          AllowUpdate     =   0   'False
  80.          HeadLines       =   1
  81.          RowHeight       =   15
  82.          BeginProperty HeadFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
  83.             Name            =   "宋体"
  84.             Size            =   9
  85.             Charset         =   134
  86.             Weight          =   400
  87.             Underline       =   0   'False
  88.             Italic          =   0   'False
  89.             Strikethrough   =   0   'False
  90.          EndProperty
  91.          BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
  92.             Name            =   "宋体"
  93.             Size            =   9
  94.             Charset         =   134
  95.             Weight          =   400
  96.             Underline       =   0   'False
  97.             Italic          =   0   'False
  98.             Strikethrough   =   0   'False
  99.          EndProperty
  100.          ColumnCount     =   2
  101.          BeginProperty Column00 
  102.             DataField       =   ""
  103.             Caption         =   ""
  104.             BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
  105.                Type            =   0
  106.                Format          =   ""
  107.                HaveTrueFalseNull=   0
  108.                FirstDayOfWeek  =   0
  109.                FirstWeekOfYear =   0
  110.                LCID            =   2052
  111.                SubFormatType   =   0
  112.             EndProperty
  113.          EndProperty
  114.          BeginProperty Column01 
  115.             DataField       =   ""
  116.             Caption         =   ""
  117.             BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
  118.                Type            =   0
  119.                Format          =   ""
  120.                HaveTrueFalseNull=   0
  121.                FirstDayOfWeek  =   0
  122.                FirstWeekOfYear =   0
  123.                LCID            =   2052
  124.                SubFormatType   =   0
  125.             EndProperty
  126.          EndProperty
  127.          SplitCount      =   1
  128.          BeginProperty Split0 
  129.             BeginProperty Column00 
  130.             EndProperty
  131.             BeginProperty Column01 
  132.             EndProperty
  133.          EndProperty
  134.       End
  135.    End
  136.    Begin VB.Frame Frame1 
  137.       Caption         =   "查询条件"
  138.       ForeColor       =   &H00FF0000&
  139.       Height          =   1470
  140.       Left            =   45
  141.       TabIndex        =   0
  142.       Top             =   105
  143.       Width           =   7545
  144.       Begin VB.CommandButton cmdExit 
  145.          Caption         =   "退 出(&E)"
  146.          Height          =   360
  147.          Left            =   6375
  148.          TabIndex        =   15
  149.          Top             =   1035
  150.          Width           =   990
  151.       End
  152.       Begin VB.CommandButton cmdOk 
  153.          Caption         =   "查 询(&F)"
  154.          Height          =   360
  155.          Left            =   6375
  156.          TabIndex        =   14
  157.          Top             =   255
  158.          Width           =   990
  159.       End
  160.       Begin VB.TextBox txtJL 
  161.          Enabled         =   0   'False
  162.          Height          =   300
  163.          Left            =   4785
  164.          TabIndex        =   13
  165.          Top             =   255
  166.          Width           =   1335
  167.       End
  168.       Begin MSComCtl2.DTPicker dtYX 
  169.          Height          =   300
  170.          Left            =   4785
  171.          TabIndex        =   12
  172.          Top             =   630
  173.          Width           =   1335
  174.          _ExtentX        =   2355
  175.          _ExtentY        =   529
  176.          _Version        =   393216
  177.          Enabled         =   0   'False
  178.          Format          =   66256897
  179.          CurrentDate     =   38056
  180.       End
  181.       Begin MSComCtl2.DTPicker dtEnd 
  182.          Height          =   300
  183.          Left            =   3465
  184.          TabIndex        =   11
  185.          Top             =   1005
  186.          Width           =   1335
  187.          _ExtentX        =   2355
  188.          _ExtentY        =   529
  189.          _Version        =   393216
  190.          Enabled         =   0   'False
  191.          Format          =   66256897
  192.          CurrentDate     =   38056
  193.       End
  194.       Begin MSComCtl2.DTPicker dtStart 
  195.          Height          =   300
  196.          Left            =   1740
  197.          TabIndex        =   10
  198.          Top             =   1005
  199.          Width           =   1335
  200.          _ExtentX        =   2355
  201.          _ExtentY        =   529
  202.          _Version        =   393216
  203.          Enabled         =   0   'False
  204.          Format          =   66256897
  205.          CurrentDate     =   38056
  206.       End
  207.       Begin VB.TextBox txtName 
  208.          Enabled         =   0   'False
  209.          Height          =   300
  210.          Left            =   1740
  211.          TabIndex        =   7
  212.          Top             =   255
  213.          Width           =   1335
  214.       End
  215.       Begin VB.ComboBox cmSex 
  216.          Enabled         =   0   'False
  217.          Height          =   300
  218.          ItemData        =   "frmDrivercha.frx":0015
  219.          Left            =   1740
  220.          List            =   "frmDrivercha.frx":001F
  221.          TabIndex        =   6
  222.          Top             =   630
  223.          Width           =   1335
  224.       End
  225.       Begin VB.CheckBox ckName 
  226.          Caption         =   "姓  名:"
  227.          Height          =   255
  228.          Left            =   195
  229.          TabIndex        =   5
  230.          Top             =   255
  231.          Width           =   1215
  232.       End
  233.       Begin VB.CheckBox ckYX 
  234.          Caption         =   "证件有效期:"
  235.          Height          =   255
  236.          Left            =   3465
  237.          TabIndex        =   4
  238.          Top             =   630
  239.          Width           =   1575
  240.       End
  241.       Begin VB.CheckBox ckBorn 
  242.          Caption         =   "出生年月:"
  243.          Height          =   255
  244.          Left            =   165
  245.          TabIndex        =   3
  246.          Top             =   1005
  247.          Width           =   1215
  248.       End
  249.       Begin VB.CheckBox ckJL 
  250.          Caption         =   "驾龄:"
  251.          Height          =   180
  252.          Left            =   3465
  253.          TabIndex        =   2
  254.          Top             =   255
  255.          Width           =   855
  256.       End
  257.       Begin VB.CheckBox ckSex 
  258.          Caption         =   "性别:"
  259.          Height          =   180
  260.          Left            =   195
  261.          TabIndex        =   1
  262.          Top             =   667
  263.          Width           =   855
  264.       End
  265.       Begin VB.Label Label3 
  266.          Caption         =   "到"
  267.          ForeColor       =   &H00FF0000&
  268.          Height          =   255
  269.          Left            =   3150
  270.          TabIndex        =   9
  271.          Top             =   1095
  272.          Width           =   255
  273.       End
  274.       Begin VB.Label Label2 
  275.          Caption         =   "从"
  276.          ForeColor       =   &H00FF0000&
  277.          Height          =   255
  278.          Left            =   1485
  279.          TabIndex        =   8
  280.          Top             =   1095
  281.          Width           =   255
  282.       End
  283.    End
  284. End
  285. Attribute VB_Name = "frmDrivercha"
  286. Attribute VB_GlobalNameSpace = False
  287. Attribute VB_Creatable = False
  288. Attribute VB_PredeclaredId = True
  289. Attribute VB_Exposed = False
  290. Private Sub ckBorn_Click()
  291.     If ckBorn.Value Then
  292.         dtStart.Enabled = True
  293.         dtEnd.Enabled = True
  294.     Else
  295.         dtStart.Enabled = False
  296.         dtEnd.Enabled = False
  297.     End If
  298. End Sub
  299. Private Sub ckJL_Click()
  300.     If ckJL.Value Then
  301.         txtJL.Enabled = True
  302.     Else
  303.         txtJL.Enabled = False
  304.     End If
  305.     
  306. End Sub
  307. Private Sub ckName_Click()
  308.     If ckName.Value Then
  309.         txtName.Enabled = True
  310.     Else
  311.         txtName.Enabled = False
  312.     End If
  313. End Sub
  314. Private Sub ckSex_Click()
  315.     If ckSex.Value Then
  316.         cmSex.Enabled = True
  317.     Else
  318.         cmSex.Enabled = False
  319.     End If
  320. End Sub
  321. Private Sub ckYX_Click()
  322.     If ckYX.Value Then
  323.         dtYX.Enabled = True
  324.     Else
  325.         dtYX.Enabled = False
  326.     End If
  327. End Sub
  328. Private Sub cmdExit_Click()
  329. MDIForm1.StatusBar1.Panels(1).Text = ""
  330.     Unload Me
  331. End Sub
  332. Private Sub cmdOk_Click()
  333.     '点击查询按纽后首先清空驾驶员档案列表
  334.     Call QingKong
  335.     Dim sql As String
  336.     Dim sname As String
  337.     If ckName.Value Then
  338.         sname = "姓名 like '" & txtName & "%'"
  339.     Else
  340.         sname = "姓名 like '%'"
  341.     End If
  342.     Dim ssex As String
  343.     If ckSex.Value Then
  344.         ssex = "性别 ='" & cmSex.Text & "'"
  345.         Else
  346.         ssex = "性别 like '%'"
  347.     End If
  348.     Dim sborn As String
  349.     If ckBorn.Value Then
  350.         sborn = "出生年月 between #" & dtStart.Month & "/" & dtStart.Day & "/" & dtStart.Year & "# and #" & dtEnd.Month & "/" & dtEnd.Day & "/" & dtEnd.Year & "#"
  351.         Else
  352.         sborn = "出生年月 like '%'"
  353.     End If
  354.     Dim sjl As String
  355.     If ckJL.Value Then
  356.         sjl = "驾龄>=" & txtJL & ""
  357.         Else
  358.         sjl = "驾龄 like '%'"
  359.     End If
  360.     Dim syx As String
  361.     If ckYX.Value Then
  362.        syx = "证件有效期 =#" & dtYX.Month & "/" & dtYX.Day & "/" & dtYX.Year & "#"
  363.        Else
  364.         syx = "证件有效期 like '%'"
  365.     End If
  366.     sql = "select * from 驾驶员档案 where " & sname & "and " & ssex & "and " & sborn & "and " & sjl & "and " & syx
  367.     If sql = "select * from 驾驶员档案 where 姓名 like '%'and 性别 like '%'and 出生年月 like '%'and 驾龄 like '%'and 证件有效期 like '%'" Then
  368.         '清空上一次的查询记录
  369.         Call QingKong
  370.         MsgBox "请选择查询条件", , "系统提示"
  371.         Exit Sub
  372.     End If
  373.     Set adors = adoCon.Execute(sql)
  374.     If adors.EOF Then
  375.         Call QingKong
  376.         MsgBox "对不起,没有符合您查询的条件!", , "系统提示"
  377.     Else
  378.        Adodc1.RecordSource = sql
  379.        Adodc1.Refresh
  380.     End If
  381.     adors.Close
  382.     ckName.Value = 0
  383.     ckSex.Value = 0
  384.     ckBorn.Value = 0
  385.     ckYX.Value = 0
  386.     ckJL.Value = 0
  387. End Sub
  388. Private Sub Form_Load()
  389.     frmDrivercha.Width = 7815
  390.     frmDrivercha.Height = 4440
  391.     cmSex.ListIndex = 0
  392.     Call Rebind
  393. End Sub
  394. Private Sub Rebind()
  395.     Frame2.Caption = "驾驶员档案列表"
  396.     Adodc1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "clgl.mdb;Persist Security Info=False"
  397.     Adodc1.RecordSource = "select * from 驾驶员档案"
  398.     Adodc1.Refresh
  399. End Sub
  400. Private Sub QingKong()
  401.     Frame2.Caption = "您所要查询的驾驶员档案如下:"
  402.     Adodc1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "clgl.mdb;Persist Security Info=False"
  403.     Adodc1.RecordSource = "select * from 驾驶员档案 where 0=1"
  404.     Adodc1.Refresh
  405. End Sub
  406. Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
  407.     cmdExit_Click
  408. End Sub