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

📄 frmdriver.frm

📁 车辆管理系统是一个协助各单位进行全面的车辆管理的系统。包括车辆档案管理;驾驶员档案管理;车辆运营信息管理;车辆事故信息管理;车辆维修信息管理;车辆费用管理等几个功能模块。
💻 FRM
字号:
VERSION 5.00
Begin VB.Form frmdriver 
   BorderStyle     =   3  'Fixed Dialog
   Caption         =   "司机信息"
   ClientHeight    =   4080
   ClientLeft      =   3270
   ClientTop       =   2025
   ClientWidth     =   8565
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MDIChild        =   -1  'True
   MinButton       =   0   'False
   ScaleHeight     =   4080
   ScaleWidth      =   8565
   ShowInTaskbar   =   0   'False
   Begin VB.CommandButton cmdexit 
      Caption         =   "返 回"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   10.5
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   495
      Left            =   5760
      TabIndex        =   20
      Top             =   3360
      Width           =   1455
   End
   Begin VB.CommandButton Cmdsave 
      Caption         =   "保 存"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   10.5
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   495
      Left            =   4080
      TabIndex        =   19
      Top             =   3360
      Width           =   1335
   End
   Begin VB.Frame Frame2 
      Caption         =   "驾照信息"
      Height          =   2535
      Left            =   4080
      TabIndex        =   1
      Top             =   480
      Width           =   4215
      Begin VB.TextBox txtitem 
         Height          =   270
         Index           =   8
         Left            =   1800
         TabIndex        =   18
         Top             =   1920
         Width           =   1815
      End
      Begin VB.TextBox txtitem 
         Height          =   270
         Index           =   7
         Left            =   1800
         TabIndex        =   17
         Top             =   1560
         Width           =   1815
      End
      Begin VB.TextBox txtitem 
         Height          =   270
         Index           =   6
         Left            =   1800
         TabIndex        =   16
         Top             =   1200
         Width           =   1815
      End
      Begin VB.TextBox txtitem 
         Height          =   270
         Index           =   0
         Left            =   1800
         TabIndex        =   15
         Top             =   840
         Width           =   1815
      End
      Begin VB.TextBox txtitem 
         Height          =   270
         Index           =   5
         Left            =   1800
         TabIndex        =   14
         Top             =   480
         Width           =   1815
      End
      Begin VB.Label Label9 
         Caption         =   "有效期结束日期"
         Height          =   255
         Left            =   240
         TabIndex        =   13
         Top             =   1920
         Width           =   1335
      End
      Begin VB.Label Label8 
         Caption         =   "有效期起始日期"
         Height          =   255
         Left            =   240
         TabIndex        =   12
         Top             =   1560
         Width           =   1335
      End
      Begin VB.Label Label7 
         Caption         =   "准驾车型"
         Height          =   255
         Left            =   240
         TabIndex        =   11
         Top             =   1200
         Width           =   855
      End
      Begin VB.Label Label6 
         Caption         =   "执照号码"
         Height          =   255
         Left            =   240
         TabIndex        =   10
         Top             =   840
         Width           =   855
      End
      Begin VB.Label Label5 
         Caption         =   "考照时间"
         Height          =   255
         Left            =   240
         TabIndex        =   9
         Top             =   480
         Width           =   855
      End
   End
   Begin VB.Frame Frame1 
      Caption         =   "司机基本信息"
      Height          =   2535
      Left            =   240
      TabIndex        =   0
      Top             =   480
      Width           =   3735
      Begin VB.ComboBox Cobsex 
         Height          =   300
         Left            =   1080
         TabIndex        =   21
         Top             =   840
         Width           =   2175
      End
      Begin VB.TextBox txtitem 
         Height          =   495
         Index           =   4
         Left            =   1080
         MultiLine       =   -1  'True
         ScrollBars      =   2  'Vertical
         TabIndex        =   8
         Top             =   1800
         Width           =   2145
      End
      Begin VB.TextBox txtitem 
         Height          =   270
         Index           =   3
         Left            =   1080
         TabIndex        =   7
         Top             =   1320
         Width           =   2175
      End
      Begin VB.TextBox txtitem 
         Height          =   270
         Index           =   1
         Left            =   1080
         TabIndex        =   6
         Top             =   360
         Width           =   2175
      End
      Begin VB.Label Label4 
         Caption         =   "家庭住址"
         Height          =   255
         Left            =   240
         TabIndex        =   5
         Top             =   1800
         Width           =   855
      End
      Begin VB.Label Label3 
         Caption         =   "出生年月"
         Height          =   255
         Left            =   240
         TabIndex        =   4
         Top             =   1320
         Width           =   735
      End
      Begin VB.Label Label2 
         Alignment       =   2  'Center
         Caption         =   "性别"
         Height          =   255
         Left            =   120
         TabIndex        =   3
         Top             =   840
         Width           =   615
      End
      Begin VB.Label Label1 
         Alignment       =   2  'Center
         Caption         =   "姓名"
         Height          =   255
         Left            =   120
         TabIndex        =   2
         Top             =   360
         Width           =   615
      End
   End
End
Attribute VB_Name = "frmdriver"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim mblChange As Boolean             '是否改动过记录,ture为改过
Dim mrc As ADODB.Recordset
Public txtsql As String                 '操作的表名称

Private Sub cmdexit_Click()
   If mblChange And Cmdsave.Enabled Then
      If MsgBox("记录已经修改,是否保存? ", vbOKCancel + vbExclamation, "警告") = vbOK Then
         Call Cmdsave_Click
      End If
   End If
   Unload Me
End Sub

Private Sub Cmdsave_Click()
  ' Dim mrc As ADODB.Recordset
   Dim intCount As Integer               ' 计数器
  ' Dim smeg As String
   'Dim sSql As String
   Dim msgtext As String             '返回execute函数值
   For intCount = 0 To 1                '判断驾照和姓名是否为空
      If Trim(txtitem(intCount) & "") = "" Then
         Select Case intCount
           Case 0
             MsgBox "执照号码不能为空!", vbOKOnly + vbExclamation, "警告"
             txtitem(intCount).SetFocus
             
           Case 1
             MsgBox "姓名不能为空!", vbOKOnly + vbExclamation, "警告"
             txtitem(intCount).SetFocus
         End Select
       Exit Sub
      End If
   Next intCount
   
   
   If Trim(txtitem(6) & "") = "" Then
      MsgBox "准驾车型不能为空", vbOKOnly + vbExclamation, "警告"
      txtitem(6).SetFocus
      Exit Sub
   End If
   
   
   If Trim(txtitem(8) & "") <> "" Then    '有效的结束时间
      If Not IsDate(txtitem(8)) Then
         MsgBox "时间格式输入有勿,请按(yyyy-mm-dd)格式输入", vbOKOnly + vbExclamation, "警告"
         txtitem(8).SetFocus
         Exit Sub
      Else
         txtitem(8) = Format(txtitem(8), "yyyy-mm-dd")
      End If
   End If
   
   
    If Trim(txtitem(7) & "") <> "" Then     '有效的开始时间
      If Not IsDate(txtitem(7)) Then
         MsgBox "时间格式输入有勿,请按(yyyy-mm-dd)格式输入", vbOKOnly + vbExclamation, "警告"
         txtitem(7).SetFocus
         Exit Sub
      Else
         txtitem(7) = Format(txtitem(7), "yyyy-mm-dd")
      End If
    End If
    
    
    If Trim(txtitem(5) & "") <> "" Then     '判断考出驾照的时间格式
      If Not IsDate(txtitem(8)) Then
         MsgBox "时间格式输入有勿,请按(yyyy-mm-dd)格式输入", vbOKOnly + vbExclamation, "警告"
         txtitem(5).SetFocus
         Exit Sub
      Else
         txtitem(5) = Format(txtitem(5), "yyyy-mm-dd")
      End If
    End If
    
    
    If Trim(txtitem(3) & "") <> "" Then    '判断出生年月的时间格式
      If Not IsDate(txtitem(3)) Then
         MsgBox "时间格式输入有勿,请按(yyyy-mm-dd)格式输入", vbOKOnly + vbExclamation, "警告"
         txtitem(8).SetFocus
         Exit Sub
      Else
         txtitem(3) = Format(txtitem(3), "yyyy-mm-dd")
      End If
    End If
    
    If gintdMode = 1 Then                  '查询是否有相同的记录
       txtsql = "select * from driver where sj_id='" & Trim(txtitem(0)) & "'"
       Set mrc = ExecuteSQL(txtsql, msgtext)
       If mrc.EOF = False Then
          MsgBox "此执照号码已经存在记录!", vbOKOnly + vbExclamation, "警告"
          txtitem(0).SetFocus
          Exit Sub
       Else
          mrc.AddNew
          mrc.Fields(0) = Trim(txtitem(0))
          mrc.Fields(1) = Trim(txtitem(1))
          mrc.Fields(2) = Cobsex.Text
          For intCount = 3 To 8
          mrc.Fields(intCount) = Trim(txtitem(intCount))
          Next intCount
          mrc.Update
       End If
       mrc.Close
       MsgBox "添加信息成功", vbOKOnly + vbExclamation, "添加信息"
    End If
    
    If gintdMode = 2 Then
    
        txtsql = "delete  from driver where sj_id='" & Trim(txtitem(0)) & "'"
        ExecuteSQL txtsql, msgtext
        txtsql = "select * from driver"
       Set mrc = ExecuteSQL(txtsql, msgtext)        '删除原来的记录
           mrc.AddNew
           mrc.Fields(0) = Trim(txtitem(0))
           mrc.Fields(1) = Trim(txtitem(1))
           mrc.Fields(2) = Cobsex.Text
       For intCount = 3 To 8
          mrc.Fields(intCount) = Trim(txtitem(intCount))
       Next intCount
       mrc.Update                                       '更新记录
       mrc.Close
       flagdEdit = True
       MsgBox "修改信息成功", vbOKOnly + vbExclamation, "修改信息"
   End If
    
    
    If gintdMode = 1 Then                            '添加状态则清空文本框
       txtitem(0) = ""
       txtitem(1) = ""
       Cobsex.Text = ""
       For intCount = 3 To 8
          txtitem(intCount) = ""
       Next intCount
       mblChange = False
    End If
    If gintdMode = 2 Then
       Unload Me
       If flagdEdit Then
          Unload frmdriverlist
       End If
       frmdriverlist.txtsql = "select * from driver"                   '重新载入数据
       frmdriverlist.Show
    End If
    
End Sub

Private Sub Form_Load()
  'Dim mrc As ADODB.Recordset
  'Dim sSql As String
  Dim Count As Integer
  Dim msgtext As String
  Cobsex.AddItem "男", 0
  Cobsex.AddItem "女", 1
  Me.Left = 3225
  Me.Top = 1695
  
  If gintdMode = 1 Then
      Me.Caption = Me.Caption & "添加"
  ElseIf gintdMode = 2 Then
      Set mrc = ExecuteSQL(txtsql, msgtext)
      If mrc.EOF = False Then
        With mrc
           If (.Fields(0) & "") <> "" And (.Fields(1) & "") <> "" And (.Fields(2) & "") <> "" Then
               txtitem(0) = .Fields(0)
               txtitem(1) = .Fields(1)
               Cobsex.Text = .Fields(2)
           End If
           For Count = 3 To 8
               If (.Fields(Count) & "") <> "" Then  '判断数据是否为空
                   txtitem(Count) = .Fields(Count)  '赋值
               End If
           Next Count
         End With
      txtitem(0).Enabled = False
      End If
      mrc.Close
      Me.Caption = Me.Caption & "修改"
  End If
  mblChange = False
End Sub

Private Sub Form_Unload(Cancel As Integer)
   gintdMode = 0
End Sub

Private Sub txtitem_Change(Index As Integer)
   mblChange = True
End Sub

Private Sub txtitem_GotFocus(Index As Integer)
  txtitem(Index).SelStart = 0
  txtitem(Index).SelLength = Len(txtitem(Index))
End Sub

Private Sub txtitem_KeyDown(Index As Integer, KeyCode As Integer, Shift As Integer)
     EnterToTab KeyCode
End Sub

⌨️ 快捷键说明

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