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

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 frmcarBFcha 
  6.    Caption         =   "车辆报废查询"
  7.    ClientHeight    =   3750
  8.    ClientLeft      =   60
  9.    ClientTop       =   345
  10.    ClientWidth     =   5610
  11.    LinkTopic       =   "Form7"
  12.    MaxButton       =   0   'False
  13.    MDIChild        =   -1  'True
  14.    ScaleHeight     =   3750
  15.    ScaleWidth      =   5610
  16.    Begin VB.CommandButton cmdExit 
  17.       Caption         =   "退 出(&E)"
  18.       Height          =   345
  19.       Left            =   4245
  20.       TabIndex        =   0
  21.       Top             =   3315
  22.       Width           =   1350
  23.    End
  24.    Begin VB.CommandButton cmdCha 
  25.       Caption         =   "查 询(&F)"
  26.       Height          =   345
  27.       Left            =   2910
  28.       TabIndex        =   11
  29.       Top             =   3315
  30.       Width           =   1350
  31.    End
  32.    Begin VB.Frame Frame1 
  33.       Caption         =   "  查询条件"
  34.       ForeColor       =   &H00FF0000&
  35.       Height          =   3180
  36.       Left            =   30
  37.       TabIndex        =   1
  38.       Top             =   45
  39.       Width           =   5520
  40.       Begin VB.CheckBox ckcp 
  41.          Caption         =   "车牌号码:"
  42.          Height          =   255
  43.          Left            =   120
  44.          TabIndex        =   8
  45.          Top             =   360
  46.          Width           =   1215
  47.       End
  48.       Begin VB.CheckBox cktime 
  49.          Caption         =   "报废日期:"
  50.          Height          =   180
  51.          Left            =   120
  52.          TabIndex        =   7
  53.          Top             =   825
  54.          Width           =   1215
  55.       End
  56.       Begin VB.CheckBox ckyy 
  57.          Caption         =   "报废原因:"
  58.          Height          =   255
  59.          Left            =   120
  60.          TabIndex        =   6
  61.          Top             =   1260
  62.          Width           =   1215
  63.       End
  64.       Begin VB.ComboBox cmcp 
  65.          Enabled         =   0   'False
  66.          Height          =   300
  67.          Left            =   1320
  68.          TabIndex        =   5
  69.          Top             =   315
  70.          Width           =   4035
  71.       End
  72.       Begin VB.ComboBox cmyy 
  73.          Enabled         =   0   'False
  74.          Height          =   300
  75.          Left            =   1320
  76.          TabIndex        =   4
  77.          Top             =   1260
  78.          Width           =   4035
  79.       End
  80.       Begin MSComCtl2.DTPicker dtEnd 
  81.          Height          =   300
  82.          Left            =   3705
  83.          TabIndex        =   2
  84.          Top             =   780
  85.          Width           =   1620
  86.          _ExtentX        =   2858
  87.          _ExtentY        =   529
  88.          _Version        =   393216
  89.          Enabled         =   0   'False
  90.          Format          =   66191361
  91.          CurrentDate     =   38053
  92.       End
  93.       Begin MSComCtl2.DTPicker dtStart 
  94.          Height          =   300
  95.          Left            =   1560
  96.          TabIndex        =   3
  97.          Top             =   780
  98.          Width           =   1620
  99.          _ExtentX        =   2858
  100.          _ExtentY        =   529
  101.          _Version        =   393216
  102.          Enabled         =   0   'False
  103.          Format          =   66191361
  104.          CurrentDate     =   38053
  105.       End
  106.       Begin MSAdodcLib.Adodc Adodc1 
  107.          Height          =   345
  108.          Left            =   1050
  109.          Top             =   2475
  110.          Visible         =   0   'False
  111.          Width           =   2325
  112.          _ExtentX        =   4101
  113.          _ExtentY        =   609
  114.          ConnectMode     =   0
  115.          CursorLocation  =   3
  116.          IsolationLevel  =   -1
  117.          ConnectionTimeout=   15
  118.          CommandTimeout  =   30
  119.          CursorType      =   3
  120.          LockType        =   3
  121.          CommandType     =   1
  122.          CursorOptions   =   0
  123.          CacheSize       =   50
  124.          MaxRecords      =   0
  125.          BOFAction       =   0
  126.          EOFAction       =   0
  127.          ConnectStringType=   1
  128.          Appearance      =   1
  129.          BackColor       =   -2147483643
  130.          ForeColor       =   -2147483640
  131.          Orientation     =   0
  132.          Enabled         =   -1
  133.          Connect         =   ""
  134.          OLEDBString     =   ""
  135.          OLEDBFile       =   ""
  136.          DataSourceName  =   ""
  137.          OtherAttributes =   ""
  138.          UserName        =   ""
  139.          Password        =   ""
  140.          RecordSource    =   ""
  141.          Caption         =   "Adodc1"
  142.          BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
  143.             Name            =   "宋体"
  144.             Size            =   9
  145.             Charset         =   134
  146.             Weight          =   400
  147.             Underline       =   0   'False
  148.             Italic          =   0   'False
  149.             Strikethrough   =   0   'False
  150.          EndProperty
  151.          _Version        =   393216
  152.       End
  153.       Begin MSDataGridLib.DataGrid DataGrid1 
  154.          Bindings        =   "frmcarBFcha.frx":0000
  155.          Height          =   1215
  156.          Left            =   90
  157.          TabIndex        =   12
  158.          Top             =   1890
  159.          Width           =   5340
  160.          _ExtentX        =   9419
  161.          _ExtentY        =   2143
  162.          _Version        =   393216
  163.          AllowUpdate     =   0   'False
  164.          ForeColor       =   4227072
  165.          HeadLines       =   1
  166.          RowHeight       =   15
  167.          BeginProperty HeadFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
  168.             Name            =   "宋体"
  169.             Size            =   9
  170.             Charset         =   134
  171.             Weight          =   400
  172.             Underline       =   0   'False
  173.             Italic          =   0   'False
  174.             Strikethrough   =   0   'False
  175.          EndProperty
  176.          BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
  177.             Name            =   "宋体"
  178.             Size            =   9
  179.             Charset         =   134
  180.             Weight          =   400
  181.             Underline       =   0   'False
  182.             Italic          =   0   'False
  183.             Strikethrough   =   0   'False
  184.          EndProperty
  185.          ColumnCount     =   2
  186.          BeginProperty Column00 
  187.             DataField       =   ""
  188.             Caption         =   ""
  189.             BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
  190.                Type            =   0
  191.                Format          =   ""
  192.                HaveTrueFalseNull=   0
  193.                FirstDayOfWeek  =   0
  194.                FirstWeekOfYear =   0
  195.                LCID            =   2052
  196.                SubFormatType   =   0
  197.             EndProperty
  198.          EndProperty
  199.          BeginProperty Column01 
  200.             DataField       =   ""
  201.             Caption         =   ""
  202.             BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
  203.                Type            =   0
  204.                Format          =   ""
  205.                HaveTrueFalseNull=   0
  206.                FirstDayOfWeek  =   0
  207.                FirstWeekOfYear =   0
  208.                LCID            =   2052
  209.                SubFormatType   =   0
  210.             EndProperty
  211.          EndProperty
  212.          SplitCount      =   1
  213.          BeginProperty Split0 
  214.             BeginProperty Column00 
  215.             EndProperty
  216.             BeginProperty Column01 
  217.             EndProperty
  218.          EndProperty
  219.       End
  220.       Begin VB.Label Label1 
  221.          Caption         =   "查询记录显示:"
  222.          ForeColor       =   &H00FF0000&
  223.          Height          =   180
  224.          Left            =   120
  225.          TabIndex        =   13
  226.          Top             =   1635
  227.          Width           =   3735
  228.       End
  229.       Begin VB.Label Label6 
  230.          Caption         =   "从"
  231.          ForeColor       =   &H00FF0000&
  232.          Height          =   255
  233.          Left            =   1320
  234.          TabIndex        =   10
  235.          Top             =   870
  236.          Width           =   255
  237.       End
  238.       Begin VB.Label Label5 
  239.          Caption         =   "到"
  240.          ForeColor       =   &H00FF0000&
  241.          Height          =   255
  242.          Left            =   3330
  243.          TabIndex        =   9
  244.          Top             =   870
  245.          Width           =   255
  246.       End
  247.    End
  248. End
  249. Attribute VB_Name = "frmcarBFcha"
  250. Attribute VB_GlobalNameSpace = False
  251. Attribute VB_Creatable = False
  252. Attribute VB_PredeclaredId = True
  253. Attribute VB_Exposed = False
  254. Private Sub ckcp_Click()
  255.   If ckcp.Value Then
  256.      cmCP.Enabled = True
  257.   Else
  258.      cmCP.Enabled = False
  259.   End If
  260. End Sub
  261. Private Sub cktime_Click()
  262.   If cktime.Value Then
  263.      dtStart.Enabled = True
  264.      dtEnd.Enabled = True
  265.   Else
  266.      dtStart.Enabled = False
  267.      dtEnd.Enabled = False
  268.   End If
  269. End Sub
  270. Private Sub ckyy_Click()
  271.   If ckyy.Value Then
  272.      cmyy.Enabled = True
  273.   Else
  274.      cmyy.Enabled = False
  275.   End If
  276. End Sub
  277. Private Sub cmdCha_Click()
  278.   '点击查询按纽后首先清空车辆报废列表
  279.   Call QingKong
  280.   '定义查询条件的字符串
  281.   Dim sql As String
  282.   Dim scp As String
  283.   If ckcp.Value Then
  284.      scp = "车牌号码 like '%" & cmCP.Text & "%'"
  285.   Else
  286.      scp = "车牌号码 like '%'"
  287.   End If
  288.   Dim stime As String
  289.   If cktime.Value Then
  290.      stime = "报废日期 between #" & dtStart.Month & "/" & dtStart.Day & "/" & dtStart.Year & "# and #" & dtEnd.Month & "/" & dtEnd.Day & "/" & dtEnd.Year & "#"
  291.   Else
  292.      stime = "报废日期 like '%'"
  293.   End If
  294.   Dim sdd As String
  295.   If ckyy.Value Then
  296.      syy = "报废原因 like'%" & cmyy.Text & "%'"
  297.   Else
  298.      syy = "报废原因 like '%'"
  299.   End If
  300.   sql = "select * from 车辆报废表 where " & scp & "and " & syy & "and " & stime
  301.   '如果没有选择查询条件,那么清空上一次查询结果并给出对话框提示,退出查询过程
  302.   If sql = "select * from 车辆报废表 where 车牌号码 like '%'and 报废原因 like '%'and 报废日期 like '%'" Then
  303.      Call QingKong
  304.      MsgBox "请选择查询条件", , "系统提示"
  305.      Exit Sub
  306.   End If
  307.   '返回符合查询条件的记录集
  308.   Set adors = adoCon.Execute(sql)
  309.   '如果记录集为空,说明没有符合条件的记录存在,清空上一次查询结果集并提示,
  310.   '退出此次查询过程,否则在datagrid1控件里显示记录集
  311.   If adors.EOF Then
  312.      Call QingKong
  313.      MsgBox "对不起,没有符合您查询条件的车辆!", , "系统提示"
  314.   Else
  315.      Adodc1.RecordSource = sql
  316.      Adodc1.Refresh
  317.   End If
  318.   adors.Close
  319.   ckcp.Value = 0
  320.   cktime.Value = 0
  321.   ckyy.Value = 0
  322. End Sub
  323. Private Sub cmdExit_Click()
  324.   MDIForm1.StatusBar1.Panels(1).Text = ""
  325.   Unload Me
  326. End Sub
  327. Private Sub Form_Load()
  328.   frmcarBFcha.Height = 4155
  329.   frmcarBFcha.Width = 5730
  330.   Label1.Caption = "车辆报废列表"
  331.   Call Rebind
  332.   '将车辆报废表里的车牌号码加到cmcp控件里
  333.   Set adors = adoCon.Execute("select distinct 车牌号码,报废原因 from 车辆报废表")
  334.   On Error Resume Next
  335.   Do
  336.     cmCP.AddItem adors.Fields(0)
  337.     cmyy.AddItem adors.Fields(1)
  338.     adors.MoveNext
  339.   Loop Until adors.EOF
  340. End Sub
  341. Private Sub Rebind()
  342.   Label1.Caption = "车辆报废列表"
  343.   '进行与数据库的绑定及选择作为记录源的表
  344.   Adodc1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "clgl.mdb " & ";Persist Security Info=False"
  345.   Adodc1.RecordSource = "select * from 车辆报废表"
  346.   Adodc1.Refresh
  347. End Sub
  348. Private Sub QingKong()
  349.     Label1.Caption = "您所要查询的报废车辆记录如下:"
  350.     Adodc1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "clgl.mdb " & ";Persist Security Info=False"
  351.     Adodc1.RecordSource = "select * from 车辆报废表 where 0=1"
  352.     Adodc1.Refresh
  353. End Sub
  354. Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
  355.     cmdExit_Click
  356. End Sub