frmbuycar.frm

来自「企业事务管理系统(程序+打包)是《数据库系统开发项目方案精解系列丛书VB数据库管」· FRM 代码 · 共 250 行

FRM
250
字号
VERSION 5.00
Object = "{86CF1D34-0C5F-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCT2.OCX"
Begin VB.Form frmBuyCar 
   BorderStyle     =   3  'Fixed Dialog
   Caption         =   "修改购车记录"
   ClientHeight    =   3360
   ClientLeft      =   45
   ClientTop       =   330
   ClientWidth     =   6150
   LinkTopic       =   "Form1"
   LockControls    =   -1  'True
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   3360
   ScaleWidth      =   6150
   ShowInTaskbar   =   0   'False
   StartUpPosition =   2  '屏幕中心
   Begin VB.CommandButton cmdCancel 
      Height          =   495
      Left            =   3480
      Picture         =   "frmBuyCar.frx":0000
      Style           =   1  'Graphical
      TabIndex        =   20
      Top             =   2600
      Width           =   1215
   End
   Begin VB.CommandButton cmdOK 
      Height          =   495
      Left            =   1200
      Picture         =   "frmBuyCar.frx":0552
      Style           =   1  'Graphical
      TabIndex        =   19
      Top             =   2600
      Width           =   1215
   End
   Begin VB.TextBox txtBuyCarID 
      Appearance      =   0  'Flat
      Enabled         =   0   'False
      Height          =   300
      Left            =   1560
      TabIndex        =   9
      Top             =   360
      Width           =   1455
   End
   Begin VB.TextBox txtType 
      Appearance      =   0  'Flat
      Height          =   300
      Left            =   4320
      TabIndex        =   8
      Top             =   360
      Width           =   1455
   End
   Begin VB.TextBox txtBuyPrice 
      Appearance      =   0  'Flat
      Height          =   300
      Left            =   4320
      TabIndex        =   7
      Top             =   1080
      Width           =   1455
   End
   Begin VB.TextBox txtBelong 
      Appearance      =   0  'Flat
      Height          =   300
      Left            =   1560
      TabIndex        =   6
      Top             =   1800
      Width           =   4215
   End
   Begin VB.TextBox txtLicense 
      Appearance      =   0  'Flat
      Height          =   300
      Left            =   1560
      TabIndex        =   5
      Top             =   720
      Width           =   1455
   End
   Begin VB.TextBox txtOutAir 
      Appearance      =   0  'Flat
      Height          =   300
      Left            =   4320
      TabIndex        =   4
      Top             =   1440
      Width           =   1455
   End
   Begin VB.TextBox txtEngineNo 
      Appearance      =   0  'Flat
      Height          =   300
      Left            =   1560
      TabIndex        =   3
      Top             =   1440
      Width           =   1455
   End
   Begin VB.TextBox txtDriver 
      Appearance      =   0  'Flat
      Height          =   300
      Left            =   4320
      TabIndex        =   2
      Top             =   720
      Width           =   1455
   End
   Begin MSComCtl2.DTPicker DTPBuyDate 
      Height          =   300
      Left            =   1560
      TabIndex        =   1
      Top             =   1080
      Width           =   1455
      _ExtentX        =   2566
      _ExtentY        =   529
      _Version        =   393216
      Format          =   26935297
      CurrentDate     =   38032
   End
   Begin VB.Label Label6 
      AutoSize        =   -1  'True
      Caption         =   "车  号"
      Height          =   180
      Left            =   900
      TabIndex        =   18
      Top             =   795
      Width           =   540
   End
   Begin VB.Label Label7 
      AutoSize        =   -1  'True
      Caption         =   "车辆编号"
      Height          =   180
      Left            =   720
      TabIndex        =   17
      Top             =   435
      Width           =   720
   End
   Begin VB.Label Label9 
      AutoSize        =   -1  'True
      Caption         =   "车辆类别"
      Height          =   180
      Left            =   3465
      TabIndex        =   16
      Top             =   435
      Width           =   720
   End
   Begin VB.Label Label10 
      AutoSize        =   -1  'True
      Caption         =   "驾驶员"
      Height          =   180
      Left            =   3645
      TabIndex        =   15
      Top             =   795
      Width           =   540
   End
   Begin VB.Label Label11 
      AutoSize        =   -1  'True
      Caption         =   "购买价格"
      Height          =   180
      Left            =   3465
      TabIndex        =   14
      Top             =   1155
      Width           =   720
   End
   Begin VB.Label Label12 
      AutoSize        =   -1  'True
      Caption         =   "排气量"
      Height          =   180
      Left            =   3645
      TabIndex        =   13
      Top             =   1515
      Width           =   540
   End
   Begin VB.Label Label13 
      AutoSize        =   -1  'True
      Caption         =   "购置日期"
      Height          =   180
      Left            =   720
      TabIndex        =   12
      Top             =   1155
      Width           =   720
   End
   Begin VB.Label Label14 
      AutoSize        =   -1  'True
      Caption         =   "引擎号码"
      Height          =   180
      Left            =   720
      TabIndex        =   11
      Top             =   1515
      Width           =   720
   End
   Begin VB.Label Label15 
      AutoSize        =   -1  'True
      Caption         =   "使用人或部门"
      Height          =   180
      Left            =   360
      TabIndex        =   10
      Top             =   1875
      Width           =   1080
   End
   Begin VB.Label Label1 
      BackStyle       =   0  'Transparent
      BorderStyle     =   1  'Fixed Single
      Height          =   2175
      Left            =   120
      TabIndex        =   0
      Top             =   120
      Width           =   5895
   End
End
Attribute VB_Name = "frmBuyCar"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit

Private Sub cmdCancel_Click()
    Unload Me
End Sub

Private Sub cmdOK_Click()
    Dim rst As New ADODB.Recordset
    Dim strsql As String
    
    If IsNumeric(Me.txtBuyPrice) = False And Me.txtBuyPrice <> "" Then
        MsgBox "购车价格必须填写数字!", vbExclamation, "购车记录"
        Exit Sub                            '价格如果填写必须是数字
    End If
    If MsgBox("确定要添加这些数据吗?", vbYesNo) = vbNo Then
        Exit Sub                            '提问是否真要添加
    End If
    strsql = "select * from tbl_buycar where buycarid='" & Me.txtBuyCarID & "'"
    rst.Open strsql, CnnDataBase, adOpenStatic, adLockOptimistic
    If rst.RecordCount <> 1 Then            '准备修改购车记录
        MsgBox "购车数据表中存在重复的此购车编号!", vbCritical, "数据库错误"
        Exit Sub
    End If
    rst!BuyCarID = Me.txtBuyCarID           '修改车辆编号
    rst!License = Me.txtLicense
    rst!BuyDate = Me.DTPBuyDate.Value
    rst!EngineNo = Me.txtEngineNo
    rst!Type = Me.txtType
    rst!Driver = Me.txtDriver
    If Me.txtBuyPrice <> "" Then            '购车价格
        rst!buyprice = Format(Me.txtBuyPrice, "##0.00")
    Else
        rst!buyprice = "0.00"
    End If
    rst!OutAir = Me.txtOutAir
    rst!Belong = Me.txtBelong
    rst.Update                              '修改完成
    MsgBox "数据修改成功!", vbInformation, "完成"
    Unload Me                               '关闭窗体
End Sub

⌨️ 快捷键说明

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