⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 frmcaryylr.frm

📁 车辆管理系统
💻 FRM
字号:
VERSION 5.00
Object = "{86CF1D34-0C5F-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCT2.OCX"
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Begin VB.Form frmcarYYlr 
   BorderStyle     =   1  'Fixed Single
   Caption         =   "车辆运营列表"
   ClientHeight    =   1665
   ClientLeft      =   45
   ClientTop       =   330
   ClientWidth     =   7635
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MDIChild        =   -1  'True
   MinButton       =   0   'False
   ScaleHeight     =   1665
   ScaleWidth      =   7635
   Begin MSAdodcLib.Adodc Adodc1 
      Height          =   330
      Left            =   2955
      Top             =   1245
      Width           =   1755
      _ExtentX        =   3096
      _ExtentY        =   582
      ConnectMode     =   0
      CursorLocation  =   3
      IsolationLevel  =   -1
      ConnectionTimeout=   15
      CommandTimeout  =   30
      CursorType      =   3
      LockType        =   3
      CommandType     =   1
      CursorOptions   =   0
      CacheSize       =   50
      MaxRecords      =   0
      BOFAction       =   0
      EOFAction       =   0
      ConnectStringType=   1
      Appearance      =   1
      BackColor       =   12632256
      ForeColor       =   -2147483640
      Orientation     =   0
      Enabled         =   -1
      Connect         =   "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=clgl.mdb;Persist Security Info=False"
      OLEDBString     =   "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=clgl.mdb;Persist Security Info=False"
      OLEDBFile       =   ""
      DataSourceName  =   ""
      OtherAttributes =   ""
      UserName        =   ""
      Password        =   ""
      RecordSource    =   "select * from 车辆运营表"
      Caption         =   "浏览"
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "宋体"
         Size            =   9
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      _Version        =   393216
   End
   Begin VB.CommandButton cmdDelete 
      Caption         =   "删 除(&D)"
      Height          =   330
      Left            =   1965
      TabIndex        =   11
      Top             =   1245
      Width           =   975
   End
   Begin VB.CommandButton cmdUpdate 
      Caption         =   "修 改(&U)"
      Height          =   330
      Left            =   1005
      TabIndex        =   12
      Top             =   1245
      Width           =   975
   End
   Begin VB.CommandButton cmdExit 
      Caption         =   "退 出(&E)"
      Height          =   330
      Left            =   6615
      TabIndex        =   10
      Top             =   1245
      Width           =   975
   End
   Begin VB.CommandButton cmdCancel 
      Caption         =   "取 消(&Q)"
      Enabled         =   0   'False
      Height          =   330
      Left            =   5655
      TabIndex        =   13
      Top             =   1245
      Width           =   975
   End
   Begin VB.CommandButton cmdok 
      Caption         =   "确 定(&O)"
      Enabled         =   0   'False
      Height          =   330
      Left            =   4695
      TabIndex        =   15
      Top             =   1245
      Width           =   975
   End
   Begin VB.CommandButton cmdAdd 
      Caption         =   "添 加(&A)"
      Height          =   330
      Left            =   45
      TabIndex        =   14
      Top             =   1245
      Width           =   975
   End
   Begin VB.Frame Frame1 
      Caption         =   "车辆运营记录"
      Height          =   1170
      Left            =   60
      TabIndex        =   0
      Top             =   60
      Width           =   7530
      Begin VB.TextBox Text4 
         DataField       =   "备注"
         DataSource      =   "Adodc1"
         Enabled         =   0   'False
         Height          =   645
         Left            =   5760
         MultiLine       =   -1  'True
         ScrollBars      =   2  'Vertical
         TabIndex        =   9
         Top             =   255
         Width           =   1650
      End
      Begin VB.TextBox Text3 
         DataField       =   "运营收入"
         DataSource      =   "Adodc1"
         Enabled         =   0   'False
         Height          =   270
         Left            =   3600
         TabIndex        =   8
         Top             =   600
         Width           =   1425
      End
      Begin VB.TextBox Text2 
         DataField       =   "运营时间"
         DataSource      =   "Adodc1"
         Enabled         =   0   'False
         Height          =   270
         Left            =   3600
         TabIndex        =   7
         Top             =   240
         Width           =   1425
      End
      Begin VB.TextBox Text1 
         DataField       =   "车牌号码"
         DataSource      =   "Adodc1"
         Enabled         =   0   'False
         Height          =   270
         Left            =   1125
         TabIndex        =   6
         Top             =   240
         Width           =   1425
      End
      Begin MSComCtl2.DTPicker DTPicker1 
         Height          =   270
         Left            =   1110
         TabIndex        =   20
         Top             =   615
         Width           =   1425
         _ExtentX        =   2514
         _ExtentY        =   476
         _Version        =   393216
         Enabled         =   0   'False
         Format          =   66322433
         CurrentDate     =   38054
      End
      Begin VB.Label Label5 
         Caption         =   "*"
         ForeColor       =   &H000000FF&
         Height          =   135
         Index           =   3
         Left            =   3450
         TabIndex        =   19
         Top             =   645
         Width           =   255
      End
      Begin VB.Label Label5 
         Caption         =   "*"
         ForeColor       =   &H000000FF&
         Height          =   135
         Index           =   2
         Left            =   3450
         TabIndex        =   18
         Top             =   300
         Width           =   255
      End
      Begin VB.Label Label5 
         Caption         =   "*"
         ForeColor       =   &H000000FF&
         Height          =   135
         Index           =   1
         Left            =   1005
         TabIndex        =   17
         Top             =   645
         Width           =   255
      End
      Begin VB.Label Label5 
         Caption         =   "*"
         ForeColor       =   &H000000FF&
         Height          =   135
         Index           =   6
         Left            =   1005
         TabIndex        =   16
         Top             =   270
         Width           =   255
      End
      Begin VB.Label Label5 
         Caption         =   "备注:"
         Height          =   165
         Index           =   0
         Left            =   5130
         TabIndex        =   5
         Top             =   315
         Width           =   915
      End
      Begin VB.Label Label4 
         Caption         =   "运营收入:"
         Height          =   165
         Left            =   2580
         TabIndex        =   4
         Top             =   645
         Width           =   915
      End
      Begin VB.Label Label3 
         Caption         =   "运营时间:"
         Height          =   165
         Left            =   2580
         TabIndex        =   3
         Top             =   315
         Width           =   915
      End
      Begin VB.Label Label2 
         Caption         =   "运营日期:"
         Height          =   165
         Left            =   165
         TabIndex        =   2
         Top             =   645
         Width           =   915
      End
      Begin VB.Label Label1 
         Caption         =   "车牌号码:"
         Height          =   165
         Left            =   165
         TabIndex        =   1
         Top             =   315
         Width           =   915
      End
   End
End
Attribute VB_Name = "frmcarYYlr"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim i As Integer
Private Sub Lockctl()
   Text1.Enabled = False: Text2.Enabled = False
   Text3.Enabled = False: Text4.Enabled = False
   DTPicker1.Enabled = False
End Sub

Private Sub Unlockctl()
   Text1.Enabled = True: Text2.Enabled = True
   Text3.Enabled = True: Text4.Enabled = True
   DTPicker1.Enabled = True
End Sub
Private Sub cmdAdd_Click()
    Unlockctl
    Adodc1.Recordset.AddNew
    Text1 = "": Text2 = ""
    Text3 = "": Text4 = ""
    DTPicker1.Value = Format(Now, "yyyy-mm-dd")
    Text1.SetFocus
    cmdOk.Enabled = True: cmdCancel.Enabled = True
    cmdUpdate.Enabled = False: cmdDelete.Enabled = False
    Adodc1.Enabled = False
    i = 1
End Sub

Private Sub cmdCancel_Click()
    On Error Resume Next     '当没有添加数据的时候 处理异常
    Adodc1.Recordset.CancelUpdate
    Adodc1.Refresh
    Lockctl
    cmdOk.Enabled = False: cmdCancel.Enabled = False
    cmdAdd.Enabled = True: cmdUpdate.Enabled = True
    cmdDelete.Enabled = True: Adodc1.Enabled = True
End Sub

Private Sub cmdDelete_Click()
    If MsgBox("您确实要删除记录吗?", vbOKCancel, "系统提示") = vbOK Then
        Adodc1.Recordset.Delete
        MsgBox " 记录已删除!", , "系统提示"
        Adodc1.Refresh
    End If
End Sub

Private Sub cmdExit_Click()
    MDIForm1.StatusBar1.Panels(1).Text = ""
    Unload Me
End Sub

Private Sub cmdOk_Click()
 Select Case i
        Case 1
          If Text1.Text = "" Then
             MsgBox "车牌号码不能为空!!", , "系统提示"
             Text1.SetFocus
             Exit Sub
          End If
          If Text2.Text = "" Then
             MsgBox "运营时间不能为空!!", , "系统提示"
             Text2.SetFocus
             Exit Sub
             Text3.SetFocus
          End If
         If Text3.Text = "" Then
           MsgBox "运营收入不能为空!!", , "系统提示"
           Text3.SetFocus
           Exit Sub
         End If
           Adodc1.Recordset.Fields(1) = DTPicker1.Value
           Adodc1.Recordset.Update
          MsgBox "记录添加成功!", , "系统提示"
        Case 2
           Adodc1.Recordset.Update
          MsgBox "记录修改成功!", , "系统提示"
  End Select
    Lockctl
    cmdOk.Enabled = False: cmdCancel.Enabled = False
    cmdAdd.Enabled = True: cmdUpdate.Enabled = True
    cmdDelete.Enabled = True: Adodc1.Enabled = True
End Sub

Private Sub cmdUpdate_Click()
    Unlockctl
    Text1.Enabled = False
    i = 2
    cmdOk.Enabled = True: cmdCancel.Enabled = True
    cmdAdd.Enabled = False: cmdDelete.Enabled = False
    Adodc1.Enabled = False
End Sub
Private Sub DTPicker1_KeyDown(KeyCode As Integer, Shift As Integer)
  If KeyCode = vbKeyReturn Then Text2.SetFocus
End Sub

Private Sub DTPicker1_KeyPress(KeyAscii As Integer)
If KeyAscii = vbKeyReturn Then Text2.SetFocus
End Sub

Private Sub Form_Load()
  frmcarYYlr.Height = 2070: frmcarYYlr.Width = 7755
  Adodc1.RecordSource = "select * from 车辆运营表"
  Adodc1.Refresh
  If Adodc1.Recordset.RecordCount > 0 Then DTPicker1.Value = Adodc1.Recordset.Fields("运营日期").Value
End Sub
Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii = vbKeyReturn Then
   If Text1.Text = "" Then
      MsgBox "车牌号码不能为空!!", , "系统提示"
      Text1.SetFocus
      Exit Sub
   End If
   DTPicker1.SetFocus
End If
End Sub

Private Sub Text1_LostFocus()
    If Text1.Text = "" Then Exit Sub
    Dim rss As New ADODB.Recordset
    Dim rss1 As New ADODB.Recordset
    Dim rss2 As New ADODB.Recordset
    '此车是否是本公司的
    Set rss = adoCon.Execute("select * from 车辆档案 where 车牌号码='" & Text1.Text & "'")
    If rss.EOF Then
       MsgBox "这辆车不属于本公司的!", , "系统提示"
       Text1.Text = ""
       Text1.SetFocus
       Exit Sub
    End If
    rss.Close
    '此车是否报废了
    Set rss1 = adoCon.Execute("select * from 车辆报废表 where 车牌号码='" & Text1.Text & "'")
    If rss1.EOF Then
    Else
       MsgBox "此车已经报废,不能参加运营!", , "系统提示"
       Text1.Text = ""
       Text1.SetFocus
       Exit Sub
    End If
    rss1.Close
    '此车是否异动了
    Set rss2 = adoCon.Execute("select * from 车辆异动表 where 车牌号码='" & Text1.Text & "'")
    If rss2.EOF Then
    Else
       MsgBox "此车为“异动车辆”不能参加运营!", , "系统提示"
       Text1.Text = ""
       Text1.SetFocus
       Exit Sub
    End If
    rss2.Close
End Sub

Private Sub Text2_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyReturn Then
   If Text2.Text = "" Then
      MsgBox "运营时间不能为空!!", , "系统提示"
      Text2.SetFocus
      Exit Sub
   End If
   Text3.SetFocus
End If
End Sub

Private Sub Text2_KeyPress(KeyAscii As Integer)
KeyAscii = valiText(KeyAscii, "0123456789." & Chr(13) & Chr(8), True)
End Sub

Private Sub Text3_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyReturn Then
   If Text3.Text = "" Then
      MsgBox "运营收入不能为空!!", , "系统提示"
      Text3.SetFocus
      Exit Sub
   End If
   Text4.SetFocus
End If
End Sub

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -