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

📄 frmleaseaddedit.frm

📁 vb与access数据库的操作实例
💻 FRM
📖 第 1 页 / 共 2 页
字号:
      TabIndex        =   1
      Top             =   1680
      Width           =   8415
      Begin MSAdodcLib.Adodc AdoCustomer 
         Height          =   375
         Left            =   6360
         Top             =   120
         Visible         =   0   'False
         Width           =   2055
         _ExtentX        =   3625
         _ExtentY        =   661
         ConnectMode     =   0
         CursorLocation  =   3
         IsolationLevel  =   -1
         ConnectionTimeout=   15
         CommandTimeout  =   30
         CursorType      =   3
         LockType        =   3
         CommandType     =   8
         CursorOptions   =   0
         CacheSize       =   50
         MaxRecords      =   0
         BOFAction       =   0
         EOFAction       =   0
         ConnectStringType=   1
         Appearance      =   1
         BackColor       =   -2147483643
         ForeColor       =   -2147483640
         Orientation     =   0
         Enabled         =   -1
         Connect         =   ""
         OLEDBString     =   ""
         OLEDBFile       =   ""
         DataSourceName  =   ""
         OtherAttributes =   ""
         UserName        =   ""
         Password        =   ""
         RecordSource    =   ""
         Caption         =   "AdoCustomer"
         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 MSDataGridLib.DataGrid DataGrid2 
         Height          =   735
         Left            =   120
         TabIndex        =   19
         Top             =   240
         Width           =   8175
         _ExtentX        =   14420
         _ExtentY        =   1296
         _Version        =   393216
         AllowUpdate     =   0   'False
         Enabled         =   0   'False
         HeadLines       =   1
         RowHeight       =   15
         BeginProperty HeadFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "宋体"
            Size            =   9
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "宋体"
            Size            =   9
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ColumnCount     =   2
         BeginProperty Column00 
            DataField       =   ""
            Caption         =   ""
            BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
               Type            =   0
               Format          =   ""
               HaveTrueFalseNull=   0
               FirstDayOfWeek  =   0
               FirstWeekOfYear =   0
               LCID            =   2052
               SubFormatType   =   0
            EndProperty
         EndProperty
         BeginProperty Column01 
            DataField       =   ""
            Caption         =   ""
            BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
               Type            =   0
               Format          =   ""
               HaveTrueFalseNull=   0
               FirstDayOfWeek  =   0
               FirstWeekOfYear =   0
               LCID            =   2052
               SubFormatType   =   0
            EndProperty
         EndProperty
         SplitCount      =   1
         BeginProperty Split0 
            BeginProperty Column00 
            EndProperty
            BeginProperty Column01 
            EndProperty
         EndProperty
      End
   End
   Begin VB.Frame Frame1 
      Caption         =   "汽车信息"
      Height          =   1095
      Left            =   120
      TabIndex        =   0
      Top             =   480
      Width           =   8415
      Begin MSAdodcLib.Adodc AdoCar 
         Height          =   375
         Left            =   6480
         Top             =   120
         Visible         =   0   'False
         Width           =   1935
         _ExtentX        =   3413
         _ExtentY        =   661
         ConnectMode     =   0
         CursorLocation  =   3
         IsolationLevel  =   -1
         ConnectionTimeout=   15
         CommandTimeout  =   30
         CursorType      =   3
         LockType        =   3
         CommandType     =   8
         CursorOptions   =   0
         CacheSize       =   50
         MaxRecords      =   0
         BOFAction       =   0
         EOFAction       =   0
         ConnectStringType=   1
         Appearance      =   1
         BackColor       =   -2147483643
         ForeColor       =   -2147483640
         Orientation     =   0
         Enabled         =   -1
         Connect         =   ""
         OLEDBString     =   ""
         OLEDBFile       =   ""
         DataSourceName  =   ""
         OtherAttributes =   ""
         UserName        =   ""
         Password        =   ""
         RecordSource    =   ""
         Caption         =   "AdoCar"
         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 MSDataGridLib.DataGrid DataGrid1 
         Height          =   735
         Left            =   120
         TabIndex        =   18
         Top             =   240
         Width           =   8175
         _ExtentX        =   14420
         _ExtentY        =   1296
         _Version        =   393216
         AllowUpdate     =   0   'False
         Enabled         =   0   'False
         HeadLines       =   1
         RowHeight       =   15
         BeginProperty HeadFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "宋体"
            Size            =   9
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "宋体"
            Size            =   9
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ColumnCount     =   2
         BeginProperty Column00 
            DataField       =   ""
            Caption         =   ""
            BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
               Type            =   0
               Format          =   ""
               HaveTrueFalseNull=   0
               FirstDayOfWeek  =   0
               FirstWeekOfYear =   0
               LCID            =   2052
               SubFormatType   =   0
            EndProperty
         EndProperty
         BeginProperty Column01 
            DataField       =   ""
            Caption         =   ""
            BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
               Type            =   0
               Format          =   ""
               HaveTrueFalseNull=   0
               FirstDayOfWeek  =   0
               FirstWeekOfYear =   0
               LCID            =   2052
               SubFormatType   =   0
            EndProperty
         EndProperty
         SplitCount      =   1
         BeginProperty Split0 
            BeginProperty Column00 
            EndProperty
            BeginProperty Column01 
            EndProperty
         EndProperty
      End
   End
   Begin VB.Label Label4 
      AutoSize        =   -1  'True
      Caption         =   "合同编号"
      Height          =   180
      Left            =   240
      TabIndex        =   10
      Top             =   150
      Width           =   720
   End
End
Attribute VB_Name = "FrmLeaseAddEdit"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Public sContractNo As String  '合同编号
Public sCarNo As String       '车牌号
Public sCustId As String      '客户编号
Dim lCost As Long         '租车费用
Dim nCnt As Integer
Dim nECnt As Integer

Private Sub Cmd_Cancel_Click()
  Unload Me
End Sub

Private Sub Cmd_OK_Click()
  '域校验
  If Len(Trim(txtReturnTime)) = 0 Then
    MsgBox ("请输入归还时间")
    txtReturnTime.SetFocus
    Exit Sub
  End If
  With MyLease
    .ContractNo = MakeStr(txtContractNo)
    .ReturnTime = MakeStr(txtReturnTime)
    .WorkDays = Val(txtWorkDays)
    .WeekEndCount = Val(txtWeekEndCount)
    .Total = Val(txtCost)
    .UserName = MakeStr(txtUserName)
    .Status = "续租"
    .UpdateAddStatus (sContractNo)
  End With
  Unload Me
End Sub

Public Sub CarRefresh()
  AdoCar.ConnectionString = Conn
  AdoCar.RecordSource = "SELECT c.CarNo AS 车牌号,c.CarName AS 车辆名称,t.TypeName AS 车辆类型," _
     + "c.Color AS 颜色,c.OilNo AS 汽油编号,c.BuyDate AS 购买日期 " _
     + " FROM Cars c,Types t" _
     + " WHERE c.TypeId=t.Id AND c.CarNO='" + Trim(sCarNo) + "'"
  AdoCar.Refresh
  Set DataGrid1.DataSource = AdoCar
  DataGrid1.Columns(0).Width = 1400
  DataGrid1.Columns(1).Width = 1400
  DataGrid1.Columns(2).Width = 1200
  DataGrid1.Columns(3).Width = 1000
  DataGrid1.Columns(4).Width = 1000
  DataGrid1.Columns(5).Width = 1600
End Sub
Public Sub CustomerRefresh()
  AdoCustomer.ConnectionString = Conn
  AdoCustomer.RecordSource = "SELECT Id AS 客户号,Name AS 姓名,Sex AS 性别,Age AS 年龄," _
     + "Telephone AS 电话,LicenseNo AS 驾驶证号,Certificate AS 抵押证件 " _
     + " FROM Customer WHERE Id='" + Trim(sCustId) + "'"
  AdoCustomer.Refresh
  Set DataGrid2.DataSource = AdoCustomer
  DataGrid2.Columns(0).Width = 1000
  DataGrid2.Columns(1).Width = 1000
  DataGrid2.Columns(2).Width = 800
  DataGrid2.Columns(3).Width = 800
  DataGrid2.Columns(4).Width = 1600
  DataGrid2.Columns(5).Width = 1600
  DataGrid2.Columns(6).Width = 1000
End Sub


Private Sub txtWeekEndCount_Change()
  '更改时间同时计算租车的总费用
  '查看租赁模式,如果为日,则按天价格计算总费用;如果按周,则将计算日期相差的周数;
  '如果按月,则计算日期相差的月份而后乘以月价格
  nCnt = Val(txtWorkDays)
  nECnt = Val(txtWeekEndCount)
  If Trim(txtLeaseMode.Text) = "日" Then
    lCost = Val(txtDayPrice) * nCnt + Val(txtWeekEndPrice) * nECnt
    txtReturnTime = Trim(DateAdd("d", nCnt + nECnt * 2, CDate(txtLeaseTime)))
  End If
  '总体消费金额还要乘以折扣,不是会员只能乘以1
  txtCost = lCost * Val(txtRate) / 10
End Sub

Private Sub txtWorkDays_Change()
  '更改时间同时计算租车的总费用
  '查看租赁模式,如果为日,则按天价格计算总费用;如果按周,则将计算日期相差的周数;
  '如果按月,则计算日期相差的月份而后乘以月价格
  nCnt = Val(txtWorkDays)
  nECnt = Val(txtWeekEndCount)
  If Trim(txtLeaseMode.Text) = "日" Then
    lCost = Val(txtDayPrice) * nCnt + Val(txtWeekEndPrice) * nECnt
    txtReturnTime = Trim(DateAdd("d", nCnt + nECnt * 2, CDate(txtLeaseTime)))
  ElseIf Trim(txtLeaseMode.Text) = "周" Then
    lCost = Val(txtDayPrice) * nCnt
    txtReturnTime = Trim(DateAdd("d", nCnt * 7, CDate(txtLeaseTime)))
  ElseIf Trim(txtLeaseMode.Text) = "月" Then
    lCost = Val(txtDayPrice) * nCnt
    txtReturnTime = Trim(DateAdd("m", nCnt, CDate(txtLeaseTime)))
  End If
  '总体消费金额还要乘以折扣,不是会员只能乘以1
  txtCost = lCost * Val(txtRate) / 10
End Sub

⌨️ 快捷键说明

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