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

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. Begin VB.Form frmcarDAlr 
  5.    BackColor       =   &H8000000A&
  6.    BorderStyle     =   3  'Fixed Dialog
  7.    Caption         =   "车辆档案记录"
  8.    ClientHeight    =   2700
  9.    ClientLeft      =   45
  10.    ClientTop       =   330
  11.    ClientWidth     =   7320
  12.    LinkTopic       =   "Form1"
  13.    MaxButton       =   0   'False
  14.    MDIChild        =   -1  'True
  15.    MinButton       =   0   'False
  16.    ScaleHeight     =   2700
  17.    ScaleWidth      =   7320
  18.    ShowInTaskbar   =   0   'False
  19.    Begin VB.ComboBox Combo2 
  20.       DataField       =   "驾驶员编号"
  21.       DataSource      =   "Adodc1"
  22.       Enabled         =   0   'False
  23.       Height          =   300
  24.       Left            =   1440
  25.       TabIndex        =   34
  26.       Top             =   1080
  27.       Width           =   1365
  28.    End
  29.    Begin VB.CommandButton cmdCancel 
  30.       Caption         =   "取 消(&Q)"
  31.       Enabled         =   0   'False
  32.       Height          =   330
  33.       Left            =   6030
  34.       TabIndex        =   1
  35.       Top             =   1875
  36.       Width           =   1095
  37.    End
  38.    Begin VB.CommandButton cmdok 
  39.       Caption         =   "确 定(&O)"
  40.       Enabled         =   0   'False
  41.       Height          =   330
  42.       Left            =   6030
  43.       TabIndex        =   4
  44.       Top             =   1560
  45.       Width           =   1095
  46.    End
  47.    Begin VB.CommandButton cmdFind 
  48.       Caption         =   "查 询(&F)"
  49.       Height          =   330
  50.       Left            =   6030
  51.       TabIndex        =   33
  52.       Top             =   1170
  53.       Width           =   1095
  54.    End
  55.    Begin VB.Frame Frame1 
  56.       Caption         =   "车辆档案记录"
  57.       BeginProperty Font 
  58.          Name            =   "宋体"
  59.          Size            =   10.5
  60.          Charset         =   134
  61.          Weight          =   700
  62.          Underline       =   0   'False
  63.          Italic          =   0   'False
  64.          Strikethrough   =   0   'False
  65.       EndProperty
  66.       ForeColor       =   &H00FF0000&
  67.       Height          =   2505
  68.       Left            =   120
  69.       TabIndex        =   6
  70.       Top             =   105
  71.       Width           =   5685
  72.       Begin VB.ComboBox Combo1 
  73.          DataField       =   "车辆类型"
  74.          DataSource      =   "Adodc1"
  75.          Enabled         =   0   'False
  76.          Height          =   300
  77.          Left            =   1320
  78.          TabIndex        =   32
  79.          Top             =   615
  80.          Width           =   1365
  81.       End
  82.       Begin VB.ComboBox cmnj 
  83.          DataField       =   "年检审"
  84.          DataSource      =   "Adodc1"
  85.          Enabled         =   0   'False
  86.          Height          =   300
  87.          ItemData        =   "frmcarDAlr.frx":0000
  88.          Left            =   4200
  89.          List            =   "frmcarDAlr.frx":000A
  90.          Style           =   2  'Dropdown List
  91.          TabIndex        =   15
  92.          Top             =   969
  93.          Width           =   1365
  94.       End
  95.       Begin VB.ComboBox cmbf 
  96.          DataField       =   "报废否"
  97.          DataSource      =   "Adodc1"
  98.          Enabled         =   0   'False
  99.          Height          =   300
  100.          ItemData        =   "frmcarDAlr.frx":0016
  101.          Left            =   4200
  102.          List            =   "frmcarDAlr.frx":0020
  103.          Style           =   2  'Dropdown List
  104.          TabIndex        =   14
  105.          Top             =   1965
  106.          Width           =   1365
  107.       End
  108.       Begin VB.ComboBox cmyd 
  109.          DataField       =   "异动否"
  110.          DataSource      =   "Adodc1"
  111.          Enabled         =   0   'False
  112.          Height          =   300
  113.          ItemData        =   "frmcarDAlr.frx":002C
  114.          Left            =   4200
  115.          List            =   "frmcarDAlr.frx":0036
  116.          Style           =   2  'Dropdown List
  117.          TabIndex        =   13
  118.          Top             =   1653
  119.          Width           =   1365
  120.       End
  121.       Begin VB.ComboBox cmbx 
  122.          DataField       =   "保险否"
  123.          DataSource      =   "Adodc1"
  124.          Enabled         =   0   'False
  125.          Height          =   300
  126.          ItemData        =   "frmcarDAlr.frx":0042
  127.          Left            =   4200
  128.          List            =   "frmcarDAlr.frx":004C
  129.          Style           =   2  'Dropdown List
  130.          TabIndex        =   12
  131.          Top             =   1311
  132.          Width           =   1365
  133.       End
  134.       Begin VB.TextBox Text4 
  135.          DataField       =   "使用人或单位"
  136.          DataSource      =   "Adodc1"
  137.          Enabled         =   0   'False
  138.          Height          =   285
  139.          Left            =   1320
  140.          TabIndex        =   11
  141.          Top             =   1311
  142.          Width           =   1365
  143.       End
  144.       Begin VB.TextBox Text5 
  145.          DataField       =   "车辆所在单位"
  146.          DataSource      =   "Adodc1"
  147.          Enabled         =   0   'False
  148.          Height          =   285
  149.          Left            =   1320
  150.          TabIndex        =   10
  151.          Top             =   1653
  152.          Width           =   1365
  153.       End
  154.       Begin VB.TextBox Text6 
  155.          DataField       =   "备注"
  156.          DataSource      =   "Adodc1"
  157.          Enabled         =   0   'False
  158.          Height          =   285
  159.          Left            =   1320
  160.          TabIndex        =   9
  161.          Top             =   1995
  162.          Width           =   1365
  163.       End
  164.       Begin VB.TextBox Text1 
  165.          DataField       =   "车牌号码"
  166.          DataSource      =   "Adodc1"
  167.          Enabled         =   0   'False
  168.          Height          =   285
  169.          Left            =   1320
  170.          TabIndex        =   8
  171.          Top             =   285
  172.          Width           =   1365
  173.       End
  174.       Begin VB.TextBox Text7 
  175.          DataField       =   "厂牌型号"
  176.          DataSource      =   "Adodc1"
  177.          Enabled         =   0   'False
  178.          Height          =   285
  179.          Left            =   4200
  180.          TabIndex        =   7
  181.          Top             =   285
  182.          Width           =   1365
  183.       End
  184.       Begin MSComCtl2.DTPicker DTPicker1 
  185.          Height          =   285
  186.          Left            =   4200
  187.          TabIndex        =   16
  188.          Top             =   615
  189.          Width           =   1365
  190.          _ExtentX        =   2408
  191.          _ExtentY        =   503
  192.          _Version        =   393216
  193.          Enabled         =   0   'False
  194.          Format          =   27000833
  195.          CurrentDate     =   38052
  196.       End
  197.       Begin MSAdodcLib.Adodc Adodc1 
  198.          Height          =   330
  199.          Left            =   1995
  200.          Top             =   2130
  201.          Visible         =   0   'False
  202.          Width           =   1455
  203.          _ExtentX        =   2566
  204.          _ExtentY        =   582
  205.          ConnectMode     =   0
  206.          CursorLocation  =   3
  207.          IsolationLevel  =   -1
  208.          ConnectionTimeout=   15
  209.          CommandTimeout  =   30
  210.          CursorType      =   3
  211.          LockType        =   3
  212.          CommandType     =   1
  213.          CursorOptions   =   0
  214.          CacheSize       =   50
  215.          MaxRecords      =   0
  216.          BOFAction       =   0
  217.          EOFAction       =   0
  218.          ConnectStringType=   1
  219.          Appearance      =   1
  220.          BackColor       =   12632256
  221.          ForeColor       =   16711680
  222.          Orientation     =   0
  223.          Enabled         =   -1
  224.          Connect         =   "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=clgl.mdb;Persist Security Info=False"
  225.          OLEDBString     =   "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=clgl.mdb;Persist Security Info=False"
  226.          OLEDBFile       =   ""
  227.          DataSourceName  =   ""
  228.          OtherAttributes =   ""
  229.          UserName        =   ""
  230.          Password        =   ""
  231.          RecordSource    =   "select * from 车辆档案"
  232.          Caption         =   "    车  辆  档  案  记  录  浏  览"
  233.          BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
  234.             Name            =   "宋体"
  235.             Size            =   10.5
  236.             Charset         =   134
  237.             Weight          =   700
  238.             Underline       =   0   'False
  239.             Italic          =   0   'False
  240.             Strikethrough   =   0   'False
  241.          EndProperty
  242.          _Version        =   393216
  243.       End
  244.       Begin MSAdodcLib.Adodc Adodc3 
  245.          Height          =   330
  246.          Left            =   2430
  247.          Top             =   2160
  248.          Visible         =   0   'False
  249.          Width           =   2010
  250.          _ExtentX        =   3545
  251.          _ExtentY        =   582
  252.          ConnectMode     =   0
  253.          CursorLocation  =   3
  254.          IsolationLevel  =   -1
  255.          ConnectionTimeout=   15
  256.          CommandTimeout  =   30
  257.          CursorType      =   3
  258.          LockType        =   3
  259.          CommandType     =   1
  260.          CursorOptions   =   0
  261.          CacheSize       =   50
  262.          MaxRecords      =   0
  263.          BOFAction       =   0
  264.          EOFAction       =   0
  265.          ConnectStringType=   1
  266.          Appearance      =   1
  267.          BackColor       =   -2147483643
  268.          ForeColor       =   -2147483640
  269.          Orientation     =   0
  270.          Enabled         =   -1
  271.          Connect         =   "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=clgl.mdb;Persist Security Info=False"
  272.          OLEDBString     =   "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=clgl.mdb;Persist Security Info=False"
  273.          OLEDBFile       =   ""
  274.          DataSourceName  =   ""
  275.          OtherAttributes =   ""
  276.          UserName        =   ""
  277.          Password        =   ""
  278.          RecordSource    =   "select * from 驾驶员档案"
  279.          Caption         =   "Adodc1"
  280.          BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
  281.             Name            =   "宋体"
  282.             Size            =   9
  283.             Charset         =   134
  284.             Weight          =   400
  285.             Underline       =   0   'False
  286.             Italic          =   0   'False
  287.             Strikethrough   =   0   'False
  288.          EndProperty
  289.          _Version        =   393216
  290.       End
  291.       Begin VB.Label Label5 
  292.          Caption         =   "*"
  293.          ForeColor       =   &H000000FF&
  294.          Height          =   135
  295.          Index           =   2
  296.          Left            =   4020
  297.          TabIndex        =   31
  298.          Top             =   675
  299.          Width           =   255
  300.       End
  301.       Begin VB.Label Label5 
  302.          Caption         =   "*"
  303.          ForeColor       =   &H000000FF&
  304.          Height          =   135
  305.          Index           =   1
  306.          Left            =   1065
  307.          TabIndex        =   30
  308.          Top             =   630
  309.          Width           =   255
  310.       End
  311.       Begin VB.Label Label5 
  312.          Caption         =   "*"
  313.          ForeColor       =   &H000000FF&
  314.          Height          =   135
  315.          Index           =   0
  316.          Left            =   1080
  317.          TabIndex        =   29
  318.          Top             =   345
  319.          Width           =   255
  320.       End
  321.       Begin VB.Label Label2 
  322.          Caption         =   "车辆类型:"
  323.          Height          =   255
  324.          Left            =   105
  325.          TabIndex        =   28
  326.          Top             =   627
  327.          Width           =   975
  328.       End
  329.       Begin VB.Label Label3 
  330.          Caption         =   "驾驶员编号:"
  331.          Height          =   255
  332.          Left            =   120
  333.          TabIndex        =   27
  334.          Top             =   969
  335.          Width           =   1095
  336.       End
  337.       Begin VB.Label Label4 
  338.          Caption         =   "购置日期:"
  339.          Height          =   255
  340.          Left            =   3120
  341.          TabIndex        =   26
  342.          Top             =   627
  343.          Width           =   975
  344.       End
  345.       Begin VB.Label Label10 
  346.          Caption         =   "使用人或单位"
  347.          Height          =   255
  348.          Left            =   105
  349.          TabIndex        =   25
  350.          Top             =   1311
  351.          Width           =   1335
  352.       End
  353.       Begin VB.Label Label11 
  354.          Caption         =   "车辆所在单位"
  355.          Height          =   255
  356.          Left            =   120
  357.          TabIndex        =   24
  358.          Top             =   1653
  359.          Width           =   1335
  360.       End
  361.       Begin VB.Label Label12 
  362.          Caption         =   "年 检 否:"
  363.          Height          =   255
  364.          Left            =   3120
  365.          TabIndex        =   23
  366.          Top             =   969
  367.          Width           =   975
  368.       End
  369.       Begin VB.Label Label13 
  370.          Caption         =   "保 险 否:"
  371.          Height          =   255
  372.          Left            =   3120
  373.          TabIndex        =   22
  374.          Top             =   1311
  375.          Width           =   975
  376.       End
  377.       Begin VB.Label Label14 
  378.          Caption         =   "异 动 否:"
  379.          Height          =   255
  380.          Left            =   3120
  381.          TabIndex        =   21
  382.          Top             =   1653
  383.          Width           =   975
  384.       End
  385.       Begin VB.Label Label15 
  386.          Caption         =   "报 废 否:"
  387.          Height          =   255
  388.          Left            =   3120
  389.          TabIndex        =   20
  390.          Top             =   1995
  391.          Width           =   975
  392.       End
  393.       Begin VB.Label Label16 
  394.          Caption         =   "备    注:"
  395.          Height          =   255
  396.          Left            =   120
  397.          TabIndex        =   19
  398.          Top             =   1995
  399.          Width           =   975
  400.       End
  401.       Begin VB.Label Label1 
  402.          Caption         =   "车牌号码:"
  403.          Height          =   255
  404.          Left            =   120
  405.          TabIndex        =   18
  406.          Top             =   285
  407.          Width           =   975
  408.       End
  409.       Begin VB.Label Label7 
  410.          Caption         =   "厂牌型号:"
  411.          Height          =   255
  412.          Left            =   3120
  413.          TabIndex        =   17
  414.          Top             =   285
  415.          Width           =   975
  416.       End
  417.    End
  418.    Begin VB.CommandButton cmdExit 
  419.       Caption         =   " 退 出(&E)"
  420.       Height          =   330
  421.       Left            =   6030
  422.       TabIndex        =   5
  423.       Top             =   2265
  424.       Width           =   1095
  425.    End
  426.    Begin VB.CommandButton cmdDelete 
  427.       Caption         =   "删 除(&D)"
  428.       Height          =   330
  429.       Left            =   6030
  430.       TabIndex        =   3
  431.       Top             =   795
  432.       Width           =   1095
  433.    End
  434.    Begin VB.CommandButton cmdUpdate 
  435.       Caption         =   "修 改(&U)"
  436.       Height          =   330
  437.       Left            =   6030
  438.       TabIndex        =   2
  439.       Top             =   480
  440.       Width           =   1095
  441.    End
  442.    Begin VB.CommandButton cmdAdd 
  443.       Caption         =   "添 加(&A)"
  444.       Height          =   330
  445.       Left            =   6030
  446.       TabIndex        =   0
  447.       Top             =   165
  448.       Width           =   1095
  449.    End
  450.    Begin MSAdodcLib.Adodc Adodc2 
  451.       Height          =   330
  452.       Left            =   1680
  453.       Top             =   2190
  454.       Visible         =   0   'False
  455.       Width           =   1830
  456.       _ExtentX        =   3228
  457.       _ExtentY        =   582
  458.       ConnectMode     =   0
  459.       CursorLocation  =   3
  460.       IsolationLevel  =   -1
  461.       ConnectionTimeout=   15
  462.       CommandTimeout  =   30
  463.       CursorType      =   3
  464.       LockType        =   3
  465.       CommandType     =   1
  466.       CursorOptions   =   0
  467.       CacheSize       =   50
  468.       MaxRecords      =   0
  469.       BOFAction       =   0
  470.       EOFAction       =   0
  471.       ConnectStringType=   1
  472.       Appearance      =   1
  473.       BackColor       =   -2147483643
  474.       ForeColor       =   -2147483640
  475.       Orientation     =   0
  476.       Enabled         =   -1
  477.       Connect         =   "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=clgl.mdb;Persist Security Info=False"
  478.       OLEDBString     =   "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=clgl.mdb;Persist Security Info=False"
  479.       OLEDBFile       =   ""
  480.       DataSourceName  =   ""
  481.       OtherAttributes =   ""
  482.       UserName        =   ""
  483.       Password        =   ""
  484.       RecordSource    =   "select * from 车辆类型表"
  485.       Caption         =   "Adodc2"
  486.       BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
  487.          Name            =   "宋体"
  488.          Size            =   9
  489.          Charset         =   134
  490.          Weight          =   400
  491.          Underline       =   0   'False
  492.          Italic          =   0   'False
  493.          Strikethrough   =   0   'False
  494.       EndProperty
  495.       _Version        =   393216
  496.    End
  497. End
  498. Attribute VB_Name = "frmcardalr"
  499. Attribute VB_GlobalNameSpace = False
  500. Attribute VB_Creatable = False
  501. Attribute VB_PredeclaredId = True
  502. Attribute VB_Exposed = False
  503. Dim i As Integer
  504. Private Sub cmbf_KeyPress(KeyAscii As Integer)
  505.     KeyAscii = valiText(KeyAscii, Chr(13), True)
  506. End Sub
  507. Private Sub cmdCancel_Click()
  508.     On Error Resume Next     '当没有添加数据的时候 处理异常
  509.     Adodc1.Recordset.CancelUpdate
  510.     Adodc1.Refresh
  511.     Lockctl
  512.     cmdok.Enabled = False: cmdCancel.Enabled = False
  513.     cmdAdd.Enabled = True: cmdUpdate.Enabled = True
  514.     cmdDelete.Enabled = True: Adodc1.Enabled = True
  515. End Sub
  516. Private Sub cmdDelete_Click()
  517.     If MsgBox("您确实要删除记录吗?", vbOKCancel, "系统提示") = vbOK Then
  518.         adoCon.Execute ("delete from 车辆档案 where 车牌号码='" & Text1 & "'")
  519.         MsgBox " 记录已删除!", , "系统提示"
  520.         Adodc1.Refresh
  521.     End If
  522. End Sub
  523. Private Sub cmdExit_Click()
  524.     MDIForm1.StatusBar1.Panels(1).Text = ""
  525.     Unload Me
  526. End Sub
  527. Private Sub cmdFind_Click()
  528.   Dim str As String
  529.   str = InputBox$("输入你要查询的车牌号码:", "系统提示")
  530.   If str = "" Then Exit Sub
  531.   Adodc1.RecordSource = "select * from 车辆档案 where 车牌号码='" + str + "'"
  532.   Adodc1.Refresh
  533.   If Adodc1.Recordset.RecordCount > 0 Then
  534.      On Error Resume Next
  535.      Text1.Text = Adodc1.Recordset.Fields(0)
  536.      Combo1.Text = Adodc1.Recordset.Fields(1)
  537.      Combo2.Text = Adodc1.Recordset.Fields(2)
  538.      DTPicker1.Value = Adodc1.Recordset.Fields(3)
  539.      Text7.Text = Adodc1.Recordset.Fields(4)
  540.      Text4.Text = Adodc1.Recordset.Fields(5)
  541.      Text5.Text = Adodc1.Recordset.Fields(6)
  542.      cmnj.Text = Adodc1.Recordset.Fields(7)
  543.      cmbx.Text = Adodc1.Recordset.Fields(8)
  544.      cmyd.Text = Adodc1.Recordset.Fields(9)
  545.      cmbf.Text = Adodc1.Recordset.Fields(10)
  546.      Text6.Text = Adodc1.Recordset.Fields(11)
  547.      cmdUpdate.Enabled = True
  548.      cmdDelete.Enabled = True
  549.   Else
  550.      MsgBox "没有你需要的信息!", , "系统提示"
  551.      cmdUpdate.Enabled = False
  552.      cmdDelete.Enabled = False
  553.   End If
  554. End Sub
  555. Private Sub cmdOk_Click()
  556.    Select Case i
  557.         Case 1
  558.             If Text1 = "" Then
  559.                 MsgBox "车牌号码不能为空", , "系统提示"
  560.                 Text1.SetFocus
  561.                 Exit Sub
  562.             End If
  563.             If Combo1.Text = "" Then
  564.                 MsgBox "车辆类型不能为空", , "系统提示"
  565.                 Combo1.SetFocus
  566.                 Exit Sub
  567.             End If
  568.             If DTPicker1.Value = "" Then
  569.                 MsgBox "购置日期不能为空", , "系统提示"
  570.                 DTPicker1.SetFocus
  571.                 Exit Sub
  572.             End If
  573.           adoCon.Execute ("insert into 车辆档案 values ('" & Text1 & "','" & Combo1 & "','" & Combo2 & "','" & DTPicker1.Value & "','" & Text7 & "','" & Text4 & "','" & Text5 & "','" & cmnj & "','" & cmbx & "','" & cmyd & "','" & cmbf & "','" & Text6 & "')")
  574.           MsgBox "记录添加成功!", , "系统提示"
  575.           Adodc1.Refresh
  576.         Case 2
  577.           adoCon.Execute ("update 车辆档案 set 车辆类型='" & Combo1 & "',驾驶员编号='" & Combo2 & "',使用人或单位='" & Text4 & "',车辆所在单位='" & Text5 & "',备注='" & Text6 & "', 厂牌型号='" & Text7 & "',购置日期='" & DTPicker1.Value & "',年检审='" & cmnj.Text & "',保险否='" & cmbx.Text & "',异动否='" & cmyd.Text & "',报废否='" & cmbf.Text & "' where 车牌号码='" & Text1 & "'")
  578.           MsgBox "记录修改成功!", , "系统提示"
  579.           Adodc1.Refresh
  580.   End Select
  581.     Lockctl
  582.     cmdok.Enabled = False: cmdCancel.Enabled = False
  583.     cmdAdd.Enabled = True: cmdUpdate.Enabled = True
  584.     cmdDelete.Enabled = True: Adodc1.Enabled = True
  585. End Sub
  586. Private Sub cmdAdd_Click()
  587.     Unlockctl
  588.     DTPicker1.Value = Format(Now, "yyyy-mm-dd")
  589.     Text1 = "": Text2 = "": Combo2 = "": Text4 = "": Text5 = "": Text6 = "": Text7 = ""
  590.     Combo1.Text = ""
  591.     cmnj.Text = "是"
  592.     cmbx.Text = "是"
  593.     cmyd.Text = "是"
  594.     cmbf.Text = "是"
  595.     Text1.SetFocus
  596.     cmdok.Enabled = True: cmdCancel.Enabled = True
  597.     cmdDelete.Enabled = False: Combo1.Visible = True
  598.     Adodc1.Enabled = False: cmdUpdate.Enabled = False
  599.     i = 1
  600.     End Sub
  601. Private Sub cmdUpdate_Click()
  602.     Unlockctl
  603.     i = 2
  604.     cmdok.Enabled = True: cmdCancel.Enabled = True
  605.     cmdAdd.Enabled = False: cmdDelete.Enabled = False
  606.     Adodc1.Enabled = False: Text1.Enabled = False
  607. End Sub
  608. Private Sub cmnj_KeyPress(KeyAscii As Integer)
  609.     KeyAscii = valiText(KeyAscii, Chr(13), True)
  610.     If KeyAscii = 13 Then cmbx.SetFocus
  611. End Sub
  612. Private Sub cmbx_KeyPress(KeyAscii As Integer)
  613.     KeyAscii = valiText(KeyAscii, Chr(13), True)
  614.     If KeyAscii = 13 Then cmyd.SetFocus
  615. End Sub
  616. Private Sub cmyd_KeyPress(KeyAscii As Integer)
  617.     KeyAscii = valiText(KeyAscii, Chr(13), True)
  618.     If KeyAscii = 13 Then cmbf.SetFocus
  619. End Sub
  620. Private Sub DTPicker1_KeyDown(KeyCode As Integer, Shift As Integer)
  621.     If KeyAscii = vbKeyReturn Then cmnj.SetFocus
  622. End Sub
  623. Private Sub Form_Load()
  624.     frmcardalr.Height = 3075: frmcardalr.Width = 7410
  625.     Adodc1.RecordSource = "select * from 车辆档案"
  626.     Adodc1.Refresh
  627.     If Adodc1.Recordset.RecordCount > 0 Then DTPicker1.Value = Adodc1.Recordset.Fields("购置日期")
  628.     Adodc2.RecordSource = "select * from 车辆类型表"
  629.     Adodc2.Refresh
  630.     
  631.     If Adodc2.Recordset.RecordCount = 0 Then Exit Sub
  632.     For i = 0 To Adodc2.Recordset.RecordCount - 1
  633.         Combo1.AddItem Adodc2.Recordset.Fields(0).Value
  634.         Adodc2.Recordset.MoveNext
  635.     Next
  636.     
  637.     Adodc3.RecordSource = "select * from 驾驶员档案"
  638.     Adodc3.Refresh
  639.     
  640.     If Adodc3.Recordset.RecordCount = 0 Then Exit Sub
  641.     For i = 0 To Adodc3.Recordset.RecordCount - 1
  642.         Combo2.AddItem Adodc3.Recordset.Fields(0).Value
  643.         Adodc3.Recordset.MoveNext
  644.     Next
  645.     On Error Resume Next
  646.     Combo1.Text = Adodc1.Recordset.Fields(1)
  647.     Combo2.Text = Adodc1.Recordset.Fields(2)
  648. End Sub
  649. Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
  650.     cmdExit_Click
  651. End Sub
  652. Private Sub Text1_KeyDown(KeyCode As Integer, Shift As Integer)
  653.     If KeyCode = 13 Then Combo1.SetFocus
  654. End Sub
  655. Private Sub Text1_LostFocus()
  656.     Dim rs As New ADODB.Recordset
  657.     Set rs = adoCon.Execute("select * from 车辆档案 where 车牌号码='" & Text1.Text & "'")
  658.     If rs.EOF = False Then
  659.         MsgBox "此车牌号码已经存在!", , "系统提示"
  660.         Text1 = ""
  661.         Text1.SetFocus
  662.     End If
  663.     rs.Close
  664. End Sub
  665. Private Sub Combo1_KeyPress(KeyAscii As Integer)
  666.    KeyAscii = valiText(KeyAscii, Chr(13), True)
  667.     If KeyAscii = 13 Then Combo2.SetFocus
  668. End Sub
  669. Private Sub Combo2_KeyPress(KeyAscii As Integer)
  670.    KeyAscii = valiText(KeyAscii, Chr(13), True)
  671.     If KeyAscii = 13 Then Text4.SetFocus
  672. End Sub
  673. 'Private Sub Text3_LostFocus()
  674. '  Adodc1.RecordSource = "select * from 驾驶员档案 where 驾驶员编号='" + Text3.Text + "'"
  675. '  Adodc1.Refresh
  676. '  If Text3.Text = "" Then Exit Sub
  677. '  If Adodc1.Recordset.RecordCount > 0 Then
  678. '  Else
  679. '     MsgBox "本公司没有驾驶员!", , "系统提示"
  680. '     Text3.SetFocus
  681. '  End If
  682. 'End Sub
  683. Private Sub Text5_KeyPress(KeyAscii As Integer)
  684.     If KeyAscii = 13 Then Text6.SetFocus
  685. End Sub
  686. Private Sub Text6_KeyPress(KeyAscii As Integer)
  687.     If KeyAscii = 13 Then Text7.SetFocus
  688. End Sub
  689. Private Sub Text4_KeyPress(KeyAscii As Integer)
  690.     If KeyAscii = 13 Then Text5.SetFocus
  691. End Sub
  692. Private Sub Text7_KeyPress(KeyAscii As Integer)
  693.     If KeyAscii = 13 Then DTPicker1.SetFocus
  694. End Sub
  695. Private Sub Lockctl()
  696.    Text1.Enabled = False: Combo1.Enabled = False: Combo2.Enabled = False
  697.    Text4.Enabled = False: Text5.Enabled = False: Text6.Enabled = False
  698.    Text7.Enabled = False
  699.    DTPicker1.Enabled = False
  700.    cmnj.Enabled = False: cmbx.Enabled = False: cmyd.Enabled = False: cmbf.Enabled = False
  701. End Sub
  702. Private Sub Unlockctl()
  703.    Text1.Enabled = True: Combo1.Enabled = True: Combo2.Enabled = True
  704.    Text4.Enabled = True: Text5.Enabled = True: Text6.Enabled = True
  705.    Text7.Enabled = True
  706.    DTPicker1.Enabled = True
  707.    cmnj.Enabled = True: cmbx.Enabled = True: cmyd.Enabled = True: cmbf.Enabled = True
  708. End Sub