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

WORD

  1. VERSION 5.00
  2. Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
  3. Object = "{CDE57A40-8B86-11D0-B3C6-00A0C90AEA82}#1.0#0"; "MSDATGRD.OCX"
  4. Begin VB.Form frmcarDAcha 
  5.    BackColor       =   &H8000000A&
  6.    Caption         =   "车辆档案查询"
  7.    ClientHeight    =   4665
  8.    ClientLeft      =   60
  9.    ClientTop       =   345
  10.    ClientWidth     =   7815
  11.    ForeColor       =   &H00808080&
  12.    LinkTopic       =   "Form1"
  13.    MDIChild        =   -1  'True
  14.    ScaleHeight     =   4665
  15.    ScaleWidth      =   7815
  16.    Begin VB.Frame Frame2 
  17.       Caption         =   "Frame2"
  18.       ForeColor       =   &H00FF0000&
  19.       Height          =   2505
  20.       Left            =   105
  21.       TabIndex        =   17
  22.       Top             =   60
  23.       Width           =   7515
  24.       Begin MSAdodcLib.Adodc Adodc3 
  25.          Height          =   345
  26.          Left            =   690
  27.          Top             =   1500
  28.          Visible         =   0   'False
  29.          Width           =   2655
  30.          _ExtentX        =   4683
  31.          _ExtentY        =   609
  32.          ConnectMode     =   0
  33.          CursorLocation  =   3
  34.          IsolationLevel  =   -1
  35.          ConnectionTimeout=   15
  36.          CommandTimeout  =   30
  37.          CursorType      =   3
  38.          LockType        =   3
  39.          CommandType     =   1
  40.          CursorOptions   =   0
  41.          CacheSize       =   50
  42.          MaxRecords      =   0
  43.          BOFAction       =   0
  44.          EOFAction       =   0
  45.          ConnectStringType=   1
  46.          Appearance      =   1
  47.          BackColor       =   -2147483643
  48.          ForeColor       =   -2147483640
  49.          Orientation     =   0
  50.          Enabled         =   -1
  51.          Connect         =   "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=clgl.mdb;Persist Security Info=False"
  52.          OLEDBString     =   "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=clgl.mdb;Persist Security Info=False"
  53.          OLEDBFile       =   ""
  54.          DataSourceName  =   ""
  55.          OtherAttributes =   ""
  56.          UserName        =   ""
  57.          Password        =   ""
  58.          RecordSource    =   "select * from 车辆档案"
  59.          Caption         =   "Adodc1"
  60.          BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
  61.             Name            =   "宋体"
  62.             Size            =   9
  63.             Charset         =   134
  64.             Weight          =   400
  65.             Underline       =   0   'False
  66.             Italic          =   0   'False
  67.             Strikethrough   =   0   'False
  68.          EndProperty
  69.          _Version        =   393216
  70.       End
  71.       Begin MSAdodcLib.Adodc Adodc2 
  72.          Height          =   345
  73.          Left            =   2430
  74.          Top             =   870
  75.          Visible         =   0   'False
  76.          Width           =   2655
  77.          _ExtentX        =   4683
  78.          _ExtentY        =   609
  79.          ConnectMode     =   0
  80.          CursorLocation  =   3
  81.          IsolationLevel  =   -1
  82.          ConnectionTimeout=   15
  83.          CommandTimeout  =   30
  84.          CursorType      =   3
  85.          LockType        =   3
  86.          CommandType     =   1
  87.          CursorOptions   =   0
  88.          CacheSize       =   50
  89.          MaxRecords      =   0
  90.          BOFAction       =   0
  91.          EOFAction       =   0
  92.          ConnectStringType=   1
  93.          Appearance      =   1
  94.          BackColor       =   -2147483643
  95.          ForeColor       =   -2147483640
  96.          Orientation     =   0
  97.          Enabled         =   -1
  98.          Connect         =   "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=clgl.mdb;Persist Security Info=False"
  99.          OLEDBString     =   "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=clgl.mdb;Persist Security Info=False"
  100.          OLEDBFile       =   ""
  101.          DataSourceName  =   ""
  102.          OtherAttributes =   ""
  103.          UserName        =   ""
  104.          Password        =   ""
  105.          RecordSource    =   "select * from 车辆档案"
  106.          Caption         =   "Adodc1"
  107.          BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
  108.             Name            =   "宋体"
  109.             Size            =   9
  110.             Charset         =   134
  111.             Weight          =   400
  112.             Underline       =   0   'False
  113.             Italic          =   0   'False
  114.             Strikethrough   =   0   'False
  115.          EndProperty
  116.          _Version        =   393216
  117.       End
  118.       Begin MSAdodcLib.Adodc Adodc1 
  119.          Height          =   345
  120.          Left            =   3225
  121.          Top             =   1650
  122.          Visible         =   0   'False
  123.          Width           =   2655
  124.          _ExtentX        =   4683
  125.          _ExtentY        =   609
  126.          ConnectMode     =   0
  127.          CursorLocation  =   3
  128.          IsolationLevel  =   -1
  129.          ConnectionTimeout=   15
  130.          CommandTimeout  =   30
  131.          CursorType      =   3
  132.          LockType        =   3
  133.          CommandType     =   1
  134.          CursorOptions   =   0
  135.          CacheSize       =   50
  136.          MaxRecords      =   0
  137.          BOFAction       =   0
  138.          EOFAction       =   0
  139.          ConnectStringType=   1
  140.          Appearance      =   1
  141.          BackColor       =   -2147483643
  142.          ForeColor       =   -2147483640
  143.          Orientation     =   0
  144.          Enabled         =   -1
  145.          Connect         =   ""
  146.          OLEDBString     =   ""
  147.          OLEDBFile       =   ""
  148.          DataSourceName  =   ""
  149.          OtherAttributes =   ""
  150.          UserName        =   ""
  151.          Password        =   ""
  152.          RecordSource    =   ""
  153.          Caption         =   "Adodc1"
  154.          BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
  155.             Name            =   "宋体"
  156.             Size            =   9
  157.             Charset         =   134
  158.             Weight          =   400
  159.             Underline       =   0   'False
  160.             Italic          =   0   'False
  161.             Strikethrough   =   0   'False
  162.          EndProperty
  163.          _Version        =   393216
  164.       End
  165.       Begin MSDataGridLib.DataGrid DataGrid1 
  166.          Bindings        =   "frmcardacha.frx":0000
  167.          Height          =   2055
  168.          Left            =   90
  169.          TabIndex        =   18
  170.          Top             =   285
  171.          Width           =   7290
  172.          _ExtentX        =   12859
  173.          _ExtentY        =   3625
  174.          _Version        =   393216
  175.          AllowUpdate     =   0   'False
  176.          BackColor       =   -2147483624
  177.          HeadLines       =   1
  178.          RowHeight       =   15
  179.          BeginProperty HeadFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
  180.             Name            =   "宋体"
  181.             Size            =   9
  182.             Charset         =   134
  183.             Weight          =   400
  184.             Underline       =   0   'False
  185.             Italic          =   0   'False
  186.             Strikethrough   =   0   'False
  187.          EndProperty
  188.          BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
  189.             Name            =   "宋体"
  190.             Size            =   9
  191.             Charset         =   134
  192.             Weight          =   400
  193.             Underline       =   0   'False
  194.             Italic          =   0   'False
  195.             Strikethrough   =   0   'False
  196.          EndProperty
  197.          ColumnCount     =   2
  198.          BeginProperty Column00 
  199.             DataField       =   ""
  200.             Caption         =   ""
  201.             BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
  202.                Type            =   0
  203.                Format          =   ""
  204.                HaveTrueFalseNull=   0
  205.                FirstDayOfWeek  =   0
  206.                FirstWeekOfYear =   0
  207.                LCID            =   2052
  208.                SubFormatType   =   0
  209.             EndProperty
  210.          EndProperty
  211.          BeginProperty Column01 
  212.             DataField       =   ""
  213.             Caption         =   ""
  214.             BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
  215.                Type            =   0
  216.                Format          =   ""
  217.                HaveTrueFalseNull=   0
  218.                FirstDayOfWeek  =   0
  219.                FirstWeekOfYear =   0
  220.                LCID            =   2052
  221.                SubFormatType   =   0
  222.             EndProperty
  223.          EndProperty
  224.          SplitCount      =   1
  225.          BeginProperty Split0 
  226.             BeginProperty Column00 
  227.             EndProperty
  228.             BeginProperty Column01 
  229.             EndProperty
  230.          EndProperty
  231.       End
  232.    End
  233.    Begin VB.CommandButton cmdCha 
  234.       Caption         =   "车辆档案查询"
  235.       Height          =   360
  236.       Left            =   6090
  237.       TabIndex        =   16
  238.       Top             =   2775
  239.       Width           =   1575
  240.    End
  241.    Begin VB.CommandButton cmdExit 
  242.       Caption         =   "退       出(&E)"
  243.       Height          =   375
  244.       Left            =   6090
  245.       TabIndex        =   15
  246.       Top             =   4215
  247.       Width           =   1575
  248.    End
  249.    Begin VB.CommandButton cmdAll 
  250.       Caption         =   "显示所有车辆档案"
  251.       Height          =   375
  252.       Left            =   6090
  253.       TabIndex        =   14
  254.       Top             =   2775
  255.       Width           =   1575
  256.    End
  257.    Begin VB.Frame Frame1 
  258.       Caption         =   "查询条件"
  259.       Enabled         =   0   'False
  260.       ForeColor       =   &H00FF0000&
  261.       Height          =   1935
  262.       Left            =   90
  263.       TabIndex        =   1
  264.       Top             =   2670
  265.       Width           =   5895
  266.       Begin VB.CheckBox ckbf 
  267.          Caption         =   "报废:"
  268.          Height          =   180
  269.          Left            =   3840
  270.          TabIndex        =   13
  271.          Top             =   1440
  272.          Width           =   855
  273.       End
  274.       Begin VB.CheckBox ckyd 
  275.          Caption         =   "异动:"
  276.          Height          =   180
  277.          Left            =   3840
  278.          TabIndex        =   12
  279.          Top             =   960
  280.          Width           =   855
  281.       End
  282.       Begin VB.CheckBox ckbx 
  283.          Caption         =   "保险:"
  284.          Height          =   255
  285.          Left            =   3840
  286.          TabIndex        =   11
  287.          Top             =   480
  288.          Width           =   855
  289.       End
  290.       Begin VB.CheckBox ckdw 
  291.          Caption         =   "车辆所在单位:"
  292.          Height          =   255
  293.          Left            =   240
  294.          TabIndex        =   10
  295.          Top             =   1440
  296.          Width           =   1575
  297.       End
  298.       Begin VB.CheckBox cklx 
  299.          Caption         =   "车辆类型:"
  300.          Height          =   255
  301.          Left            =   240
  302.          TabIndex        =   9
  303.          Top             =   960
  304.          Width           =   1215
  305.       End
  306.       Begin VB.CheckBox ckcp 
  307.          Caption         =   "车牌号码:"
  308.          Height          =   255
  309.          Left            =   240
  310.          TabIndex        =   8
  311.          Top             =   480
  312.          Width           =   1215
  313.       End
  314.       Begin VB.ComboBox Combo6 
  315.          Enabled         =   0   'False
  316.          Height          =   300
  317.          ItemData        =   "frmcardacha.frx":0015
  318.          Left            =   4680
  319.          List            =   "frmcardacha.frx":001F
  320.          TabIndex        =   7
  321.          Top             =   1440
  322.          Width           =   975
  323.       End
  324.       Begin VB.ComboBox Combo5 
  325.          Enabled         =   0   'False
  326.          Height          =   300
  327.          ItemData        =   "frmcardacha.frx":002B
  328.          Left            =   4680
  329.          List            =   "frmcardacha.frx":0035
  330.          TabIndex        =   6
  331.          Top             =   960
  332.          Width           =   975
  333.       End
  334.       Begin VB.ComboBox Combo4 
  335.          Enabled         =   0   'False
  336.          Height          =   300
  337.          ItemData        =   "frmcardacha.frx":0041
  338.          Left            =   4680
  339.          List            =   "frmcardacha.frx":004B
  340.          TabIndex        =   5
  341.          Top             =   480
  342.          Width           =   975
  343.       End
  344.       Begin VB.ComboBox Combo3 
  345.          Enabled         =   0   'False
  346.          Height          =   300
  347.          Left            =   1800
  348.          TabIndex        =   4
  349.          Top             =   1440
  350.          Width           =   1695
  351.       End
  352.       Begin VB.ComboBox Combo2 
  353.          Enabled         =   0   'False
  354.          Height          =   300
  355.          Left            =   1800
  356.          TabIndex        =   3
  357.          Top             =   960
  358.          Width           =   1695
  359.       End
  360.       Begin VB.ComboBox Combo1 
  361.          Enabled         =   0   'False
  362.          Height          =   300
  363.          Left            =   1800
  364.          TabIndex        =   2
  365.          Top             =   480
  366.          Width           =   1695
  367.       End
  368.    End
  369.    Begin VB.CommandButton cmdOk 
  370.       Caption         =   " 查       询(&F)"
  371.       Enabled         =   0   'False
  372.       Height          =   375
  373.       Left            =   6090
  374.       TabIndex        =   0
  375.       Top             =   3495
  376.       Width           =   1575
  377.    End
  378. End
  379. Attribute VB_Name = "frmcardacha"
  380. Attribute VB_GlobalNameSpace = False
  381. Attribute VB_Creatable = False
  382. Attribute VB_PredeclaredId = True
  383. Attribute VB_Exposed = False
  384. Private Sub ckbf_Click()
  385.   If ckbf.Value Then
  386.      Combo6.Enabled = True
  387.   Else
  388.      Combo6.Enabled = False
  389.   End If
  390. End Sub
  391. Private Sub ckbx_Click()
  392.   If ckbx.Value Then
  393.      Combo4.Enabled = True
  394.   Else
  395.      Combo4.Enabled = False
  396.   End If
  397. End Sub
  398. Private Sub ckcp_Click()
  399.   If ckcp.Value Then
  400.       Combo1.Enabled = True
  401.   Else
  402.       Combo1.Enabled = False
  403.   End If
  404. End Sub
  405. Private Sub ckdw_Click()
  406.   If ckdw.Value Then
  407.      Combo3.Enabled = True
  408.   Else
  409.      Combo3.Enabled = False
  410.   End If
  411. End Sub
  412. Private Sub cklx_Click()
  413.   If cklx.Value Then
  414.      Combo2.Enabled = True
  415.   Else
  416.      Combo2.Enabled = False
  417.   End If
  418. End Sub
  419. Private Sub ckyd_Click()
  420.   If ckyd.Value Then
  421.      Combo5.Enabled = True
  422.   Else
  423.      Combo5.Enabled = False
  424.   End If
  425. End Sub
  426. Private Sub cmdAll_Click()
  427.   Frame1.Enabled = False
  428.   ckcp.Value = 0
  429.   cklx.Value = 0
  430.   ckdw.Value = 0
  431.   ckbx.Value = 0
  432.   ckyd.Value = 0
  433.   ckbf.Value = 0
  434.   Call Rebind
  435.   cmdCha.Visible = True
  436.   cmdAll.Visible = False
  437.   cmdok.Enabled = False
  438. End Sub
  439. Private Sub cmdExit_Click()
  440.   MDIForm1.StatusBar1.Panels(1).Text = ""
  441.   Unload Me
  442. End Sub
  443. Private Sub cmdCha_Click()
  444.   '点击查询按纽后首先清空车辆档案列表
  445.   Call QingKong
  446.   cmdCha.Visible = False
  447.   cmdAll.Visible = True
  448.   Frame1.Enabled = True
  449.   cmdok.Enabled = True
  450. End Sub
  451. Private Sub cmdOk_Click()
  452.     Dim sql As String
  453.     Dim scp As String
  454.     If ckcp.Value Then
  455.        scp = "车牌号码 like '" & Combo1.Text & "%'"
  456.     Else
  457.        scp = "车牌号码 like '%'"
  458.     End If
  459.     Dim slx As String
  460.     If cklx.Value Then
  461.         slx = "车辆类型 like'%" & Combo2.Text & "%'"
  462.         Else
  463.         slx = "车辆类型 like '%'"
  464.     End If
  465.     
  466.     Dim sdw As String
  467.     If ckdw.Value Then
  468.         sdw = "车辆所在单位 like'%" & Combo3.Text & "%'"
  469.         Else
  470.         sdw = "车辆所在单位 like '%'"
  471.     End If
  472.     
  473.     Dim sbx As String
  474.     If ckbx.Value Then
  475.         sbx = "保险否='" & Combo4.Text & "'"
  476.         Else
  477.         sbx = "保险否 like '%'"
  478.     End If
  479.     
  480.     Dim syd As String
  481.     If ckyd.Value Then
  482.        syd = "异动否='" & Combo5.Text & "'"
  483.        Else
  484.         syd = "异动否 like '%'"
  485.     End If
  486.     
  487.     Dim sbf As String
  488.     If ckbf.Value Then
  489.         sbf = " 报废否='" & Combo6.Text & "'"
  490.         Else
  491.         sbf = "报废否 like '%'"
  492.     End If
  493.     
  494.     sql = "select * from 车辆档案 where " & scp & "and " & slx & "and " & sdw & "and " & sbx & "and " & syd & "and " & sbf
  495.     'MsgBox sql
  496.     
  497.     If sql = "select * from 车辆档案 where 车牌号码 like '%'and 车辆类型 like '%'and 车辆所在单位 like '%'and 保险否 like '%'and 异动否 like '%'and 报废否 like '%'" Then
  498.         MsgBox "请选择查询条件", , "系统提示"
  499.         
  500.         '清空上一次的查询记录
  501.         Call QingKong
  502.         Exit Sub
  503.     End If
  504.     Set adors = adoCon.Execute(sql)
  505.     If adors.EOF Then
  506.        '清空上一次的查询记录
  507.         Call QingKong
  508.        '给出文本框提示
  509.         MsgBox "没有符合您查询车辆的条件!", , "系统提示"
  510.     Else
  511.        Adodc1.RecordSource = sql
  512.        Adodc1.Refresh
  513.     End If
  514.     adors.Close
  515.     ckcp.Value = 0
  516.     cklx.Value = 0
  517.     ckdw.Value = 0
  518.     ckbx.Value = 0
  519.     ckyd.Value = 0
  520.     ckbf.Value = 0
  521. End Sub
  522. Private Sub Form_Load()
  523.     Adodc1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "clgl.mdb;Persist Security Info=False"
  524.     Call Rebind
  525.     cmdAll.Visible = False
  526.     cmdCha.Visible = True
  527.     cmdok.Enabled = False
  528.     frmcardacha.Height = 5070
  529.     frmcardacha.Width = 7935
  530.    '将表里存在的所有车牌加到控件combo1里
  531.    On Error Resume Next
  532.    Adodc1.RecordSource = "select distinct 车牌号码 from 车辆档案"
  533.     Do
  534.         Combo1.AddItem Adodc1.Recordset.Fields(0)
  535.         Adodc1.Recordset.MoveNext
  536.     Loop Until Adodc1.Recordset.EOF
  537.     Adodc1.Refresh
  538.     Adodc2.RecordSource = "select distinct 车辆类型 from 车辆档案"
  539.     Adodc2.Refresh
  540.     Do
  541.         Combo2.AddItem Adodc2.Recordset.Fields(0)
  542.         Adodc2.Recordset.MoveNext
  543.     Loop Until Adodc2.Recordset.EOF
  544.     Adodc3.RecordSource = "select distinct 车辆所在单位 from 车辆档案"
  545.     Adodc3.Refresh
  546.     Do
  547.         Combo3.AddItem Adodc3.Recordset.Fields(0)
  548.         Adodc3.Recordset.MoveNext
  549.     Loop Until Adodc3.Recordset.EOF
  550.        Adodc1.RecordSource = "select * from 车辆档案"
  551.        Adodc1.Refresh
  552. End Sub
  553. Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
  554.     cmdExit_Click
  555. End Sub
  556. Private Sub Rebind()
  557.     Frame2.Caption = "车辆档案列表"
  558.     '联接数据库及选表
  559.     Adodc1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "clgl.mdb " & ";Persist Security Info=False"
  560.     Adodc1.RecordSource = "select * from 车辆档案"
  561.     Adodc1.Refresh
  562. End Sub
  563. Private Sub QingKong()
  564.     Frame2.Caption = "您所要查询的车辆档案如下:"
  565.     '清空datagrid1控件里的记录
  566.     Adodc1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "clgl.mdb " & ";Persist Security Info=False"
  567.     Adodc1.RecordSource = "select * from 车辆档案 where 0=1"
  568.     Adodc1.Refresh
  569. End Sub