www.pudn.com > vb625557712344.rar > FrmDriverEdit.frm, change:2004-08-16,size:7875b


VERSION 5.00 
Begin VB.Form FrmDriverEdit  
   Caption         =   "编辑驾驶员信息" 
   ClientHeight    =   2895 
   ClientLeft      =   60 
   ClientTop       =   345 
   ClientWidth     =   6390 
   LinkTopic       =   "Form1" 
   ScaleHeight     =   2895 
   ScaleWidth      =   6390 
   StartUpPosition =   2  '屏幕中心 
   Begin VB.CommandButton Cmd_Exit  
      Caption         =   "取 消" 
      Height          =   375 
      Left            =   3720 
      TabIndex        =   12 
      Top             =   2400 
      Width           =   1215 
   End 
   Begin VB.CommandButton Cmd_OK  
      Caption         =   "确 定" 
      Height          =   375 
      Left            =   1680 
      TabIndex        =   11 
      Top             =   2400 
      Width           =   1215 
   End 
   Begin VB.Frame Frame1  
      Caption         =   "基本信息" 
      Height          =   2175 
      Left            =   120 
      TabIndex        =   0 
      Top             =   120 
      Width           =   6135 
      Begin VB.ComboBox cob_Status  
         Height          =   300 
         ItemData        =   "FrmDriverEdit.frx":0000 
         Left            =   4200 
         List            =   "FrmDriverEdit.frx":0010 
         TabIndex        =   19 
         Top             =   1695 
         Width           =   1215 
      End 
      Begin VB.TextBox txtEngageDate  
         Height          =   270 
         Left            =   4200 
         TabIndex        =   17 
         Top             =   1200 
         Width           =   1215 
      End 
      Begin VB.TextBox txtLNo  
         BeginProperty DataFormat  
            Type            =   0 
            Format          =   "yyyy-MM-dd" 
            HaveTrueFalseNull=   0 
            FirstDayOfWeek  =   0 
            FirstWeekOfYear =   0 
            LCID            =   2052 
            SubFormatType   =   0 
         EndProperty 
         Height          =   300 
         Left            =   960 
         TabIndex        =   15 
         Top             =   1200 
         Width           =   1215 
      End 
      Begin VB.ComboBox cob_Sex  
         Height          =   300 
         ItemData        =   "FrmDriverEdit.frx":002C 
         Left            =   2760 
         List            =   "FrmDriverEdit.frx":0036 
         TabIndex        =   14 
         Top             =   360 
         Width           =   975 
      End 
      Begin VB.TextBox txtAddress  
         Height          =   270 
         Left            =   960 
         TabIndex        =   13 
         Top             =   1680 
         Width           =   1935 
      End 
      Begin VB.TextBox txtTelephone  
         Height          =   300 
         Left            =   4200 
         TabIndex        =   9 
         Top             =   720 
         Width           =   1215 
      End 
      Begin VB.TextBox txtIdCard  
         Height          =   300 
         Left            =   960 
         TabIndex        =   7 
         Top             =   700 
         Width           =   1935 
      End 
      Begin VB.TextBox txtAge  
         Height          =   300 
         Left            =   4680 
         TabIndex        =   4 
         Top             =   360 
         Width           =   1095 
      End 
      Begin VB.TextBox txtName  
         Height          =   300 
         Left            =   720 
         TabIndex        =   2 
         Top             =   360 
         Width           =   1095 
      End 
      Begin VB.Label Label14  
         AutoSize        =   -1  'True 
         Caption         =   "当前状态" 
         Height          =   180 
         Left            =   3360 
         TabIndex        =   20 
         Top             =   1680 
         Width           =   720 
      End 
      Begin VB.Label Label12  
         AutoSize        =   -1  'True 
         Caption         =   "聘用日期" 
         Height          =   180 
         Left            =   3360 
         TabIndex        =   18 
         Top             =   1200 
         Width           =   720 
      End 
      Begin VB.Label Label10  
         AutoSize        =   -1  'True 
         Caption         =   "驾驶证号" 
         Height          =   180 
         Left            =   120 
         TabIndex        =   16 
         Top             =   1200 
         Width           =   720 
      End 
      Begin VB.Label Label8  
         AutoSize        =   -1  'True 
         Caption         =   "联系地址" 
         Height          =   180 
         Left            =   120 
         TabIndex        =   10 
         Top             =   1680 
         Width           =   720 
      End 
      Begin VB.Label Label7  
         AutoSize        =   -1  'True 
         Caption         =   "联系电话" 
         Height          =   180 
         Left            =   3360 
         TabIndex        =   8 
         Top             =   720 
         Width           =   720 
      End 
      Begin VB.Label Label6  
         AutoSize        =   -1  'True 
         Caption         =   "身份证号" 
         Height          =   180 
         Left            =   120 
         TabIndex        =   6 
         Top             =   700 
         Width           =   720 
      End 
      Begin VB.Label Label3  
         AutoSize        =   -1  'True 
         Caption         =   "性别" 
         Height          =   180 
         Left            =   2160 
         TabIndex        =   5 
         Top             =   360 
         Width           =   360 
      End 
      Begin VB.Label Label2  
         AutoSize        =   -1  'True 
         Caption         =   "年龄" 
         Height          =   180 
         Left            =   4080 
         TabIndex        =   3 
         Top             =   360 
         Width           =   360 
      End 
      Begin VB.Label Label1  
         AutoSize        =   -1  'True 
         Caption         =   "姓名" 
         Height          =   180 
         Left            =   120 
         TabIndex        =   1 
         Top             =   360 
         Width           =   360 
      End 
   End 
End 
Attribute VB_Name = "FrmDriverEdit" 
Attribute VB_GlobalNameSpace = False 
Attribute VB_Creatable = False 
Attribute VB_PredeclaredId = True 
Attribute VB_Exposed = False 
Public Modify As Boolean '插入=false,修改=true 
Public OriId As Long  '驾驶员编号 
 
Private Sub Cmd_Exit_Click() 
  Unload Me 
End Sub 
 
Private Sub Cmd_OK_Click() 
  '检查用户录入数据的有效性 
  If Len(Trim(txtName)) = 0 Then 
    MsgBox "请输入驾驶员姓名" 
    txtName.SetFocus 
    Exit Sub 
  End If 
  If Len(Trim(txtAge)) = 0 Then 
    MsgBox "请输入年龄" 
    txtAge.SetFocus 
    Exit Sub 
  End If 
  If Len(Trim(txtIdCard)) = 0 Then 
    MsgBox "请输入身份证号" 
    txtIdCard.SetFocus 
    Exit Sub 
  End If 
  If Len(Trim(txtTelephone)) = 0 Then 
    MsgBox "请输入联系电话" 
    txtTelephone.SetFocus 
    Exit Sub 
  End If 
  If Len(Trim(txtLNo)) = 0 Then 
    MsgBox "请输入驾驶证号" 
    txtLNo.SetFocus 
    Exit Sub 
  End If 
  If Len(Trim(txtEngageDate)) = 0 Then 
    MsgBox "请输入聘用日期" 
    txtEngageDate.SetFocus 
    Exit Sub 
  End If 
  If Len(Trim(cob_Status.Text)) = 0 Then 
    MsgBox "请选择驾驶员当前状态" 
    cob_Status.SetFocus 
    Exit Sub 
  End If 
   
  '把用户录入的数据赋值到数据库对象变量中 
  With MyDriver 
    .Name = MakeStr(txtName) 
    .Age = Val(txtAge) 
    .Sex = MakeStr(cob_Sex.Text) 
    .IdCard = MakeStr(txtIdCard) 
    .Telephone = MakeStr(txtTelephone) 
    .Address = MakeStr(txtAddress) 
    .LicenseNo = MakeStr(txtLNo) 
    .EngageDate = MakeStr(txtEngageDate) 
    .Status = MakeStr(cob_Status.Text) 
    '根据变量Modify的值,决定是插入新数据,还是修改已有的数据 
    If Modify = False Then 
      .Insert 
    Else 
      .Update (OriId) 
    End If 
  End With 
  '关闭窗口 
  Unload Me 
End Sub