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

📄 frmdiscardedit.frm

📁 vb与access数据库的操作实例
💻 FRM
字号:
VERSION 5.00
Begin VB.Form FrmDiscardEdit 
   Caption         =   "编辑设备报废信息"
   ClientHeight    =   6360
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   5895
   LinkTopic       =   "Form1"
   ScaleHeight     =   6360
   ScaleWidth      =   5895
   StartUpPosition =   2  '屏幕中心
   Begin VB.Frame Frame3 
      Caption         =   "审批意见"
      Enabled         =   0   'False
      Height          =   1695
      Left            =   120
      TabIndex        =   25
      Top             =   4080
      Width           =   5655
      Begin VB.TextBox txtResult 
         Height          =   690
         Left            =   960
         TabIndex        =   30
         Top             =   840
         Width           =   4455
      End
      Begin VB.TextBox txtChkDate 
         Height          =   330
         Left            =   960
         TabIndex        =   27
         Top             =   315
         Width           =   1575
      End
      Begin VB.TextBox txtChecker 
         Height          =   330
         Left            =   3840
         TabIndex        =   26
         Top             =   315
         Width           =   1575
      End
      Begin VB.Label Label13 
         AutoSize        =   -1  'True
         Caption         =   "审批意见"
         Height          =   180
         Left            =   120
         TabIndex        =   31
         Top             =   840
         Width           =   720
      End
      Begin VB.Label Label2 
         AutoSize        =   -1  'True
         Caption         =   "审批日期"
         Height          =   180
         Left            =   120
         TabIndex        =   29
         Top             =   390
         Width           =   720
      End
      Begin VB.Label Label6 
         AutoSize        =   -1  'True
         Caption         =   "审 批 人"
         Height          =   180
         Left            =   3000
         TabIndex        =   28
         Top             =   390
         Width           =   720
      End
   End
   Begin VB.TextBox txtCreateDate 
      Height          =   330
      Left            =   1080
      TabIndex        =   24
      Top             =   165
      Width           =   1575
   End
   Begin VB.Frame Frame2 
      Caption         =   "报废信息"
      Height          =   1575
      Left            =   120
      TabIndex        =   16
      Top             =   2400
      Width           =   5655
      Begin VB.TextBox txtDSum 
         Height          =   330
         Left            =   3840
         TabIndex        =   19
         Text            =   "0"
         Top             =   240
         Width           =   1575
      End
      Begin VB.TextBox txtReason 
         Height          =   690
         Left            =   960
         TabIndex        =   18
         Top             =   720
         Width           =   4455
      End
      Begin VB.TextBox txtDCount 
         Height          =   330
         Left            =   960
         TabIndex        =   17
         Text            =   "1"
         Top             =   240
         Width           =   1575
      End
      Begin VB.Label Label11 
         AutoSize        =   -1  'True
         Caption         =   "报废原因"
         Height          =   180
         Left            =   120
         TabIndex        =   22
         Top             =   720
         Width           =   720
      End
      Begin VB.Label Label10 
         AutoSize        =   -1  'True
         Caption         =   "折算金额"
         Height          =   180
         Left            =   3000
         TabIndex        =   21
         Top             =   315
         Width           =   720
      End
      Begin VB.Label Label7 
         AutoSize        =   -1  'True
         Caption         =   "报废数量"
         Height          =   180
         Left            =   120
         TabIndex        =   20
         Top             =   315
         Width           =   720
      End
   End
   Begin VB.TextBox txtUserName 
      Height          =   330
      Left            =   3960
      TabIndex        =   11
      Top             =   165
      Width           =   1575
   End
   Begin VB.CommandButton Cmd_Cancel 
      Caption         =   "取 消"
      Height          =   375
      Left            =   3360
      TabIndex        =   8
      Top             =   5880
      Width           =   1215
   End
   Begin VB.CommandButton Cmd_OK 
      Caption         =   "确 定"
      Height          =   375
      Left            =   1320
      TabIndex        =   7
      Top             =   5880
      Width           =   1215
   End
   Begin VB.Frame Frame1 
      Caption         =   "设备信息"
      Height          =   1695
      Left            =   120
      TabIndex        =   0
      Top             =   600
      Width           =   5655
      Begin VB.CommandButton Cmd_DeviceSel 
         Caption         =   "选择"
         Height          =   375
         Left            =   2760
         TabIndex        =   15
         Top             =   285
         Width           =   735
      End
      Begin VB.TextBox txtId 
         Enabled         =   0   'False
         Height          =   330
         Left            =   960
         TabIndex        =   13
         Top             =   285
         Width           =   1575
      End
      Begin VB.TextBox txtUnit 
         Enabled         =   0   'False
         Height          =   330
         Left            =   3840
         TabIndex        =   10
         Top             =   1200
         Width           =   1575
      End
      Begin VB.TextBox txtTypeName 
         Enabled         =   0   'False
         Height          =   330
         Left            =   960
         TabIndex        =   9
         Top             =   1200
         Width           =   1575
      End
      Begin VB.TextBox txtModel 
         Enabled         =   0   'False
         Height          =   330
         Left            =   3840
         TabIndex        =   5
         Top             =   765
         Width           =   1575
      End
      Begin VB.TextBox txtName 
         Enabled         =   0   'False
         Height          =   330
         Left            =   960
         TabIndex        =   2
         Top             =   765
         Width           =   1575
      End
      Begin VB.Label Label4 
         AutoSize        =   -1  'True
         Caption         =   "设备编号"
         Height          =   180
         Left            =   120
         TabIndex        =   14
         Top             =   360
         Width           =   720
      End
      Begin VB.Label Label8 
         AutoSize        =   -1  'True
         Caption         =   "分类名称"
         Height          =   180
         Left            =   120
         TabIndex        =   6
         Top             =   1275
         Width           =   720
      End
      Begin VB.Label Label5 
         AutoSize        =   -1  'True
         Caption         =   "设备型号"
         Height          =   180
         Left            =   3000
         TabIndex        =   4
         Top             =   840
         Width           =   720
      End
      Begin VB.Label Label3 
         AutoSize        =   -1  'True
         Caption         =   "计量单位"
         Height          =   180
         Left            =   3000
         TabIndex        =   3
         Top             =   1245
         Width           =   720
      End
      Begin VB.Label Label1 
         AutoSize        =   -1  'True
         Caption         =   "设备名称"
         Height          =   180
         Left            =   120
         TabIndex        =   1
         Top             =   840
         Width           =   720
      End
   End
   Begin VB.Label Label12 
      AutoSize        =   -1  'True
      Caption         =   "申请日期"
      Height          =   180
      Left            =   240
      TabIndex        =   23
      Top             =   240
      Width           =   720
   End
   Begin VB.Label Label9 
      AutoSize        =   -1  'True
      Caption         =   "申 请 人"
      Height          =   180
      Left            =   3120
      TabIndex        =   12
      Top             =   240
      Width           =   720
   End
End
Attribute VB_Name = "FrmDiscardEdit"
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_Cancel_Click()
  Unload Me
End Sub

Private Sub Cmd_DeviceSel_Click()
  '选择设备
  FrmDeviceSel.nFlag = 0
  FrmDeviceSel.Show 1
  '读取指定对象信息
  txtId = Trim(MyDeviceSel.Id)
  txtName = Trim(MyDeviceSel.Name)
  txtModel = Trim(MyDeviceSel.Model)
  '取得分类名称
  If MyType.GetInfo(MyDeviceSel.TypeId) = True Then
    txtTypeName = Trim(MyType.TypeName)
  Else
    txtTypeName = ""
  End If
  txtUnit = Trim(MyDeviceSel.Unit)
End Sub

Private Sub Cmd_OK_Click()
  '如果为申请,则需要检查用户录入数据的有效性
  If Len(Trim(txtId)) = 0 Then
    MsgBox ("请选择设备")
    Cmd_DeviceSel.SetFocus
    Exit Sub
  End If
  If Len(Trim(txtUserName)) = 0 Then
    MsgBox "请输入申请人"
    txtUserName.SetFocus
    Exit Sub
  End If
  If Len(Trim(txtCreateDate)) = 0 Then
    MsgBox "请输入申请日期"
    txtCreateDate.SetFocus
    Exit Sub
  End If
  If Len(Trim(txtDCount)) = 0 Or Val(txtDCount) <= 0 Then
    MsgBox "请输入报废数量,报废数量不能为0"
    txtDCount.SetFocus
    Exit Sub
  End If
  If Len(Trim(txtReason)) = 0 Then
    MsgBox "请输入报废原因"
    txtReason.SetFocus
    Exit Sub
  End If
  '把用户录入的数据赋值到数据库对象变量中
  With MyDiscard
    .DevId = MakeStr(txtId)
    .CreateDate = MakeStr(txtCreateDate)
    .DCount = Val(txtDCount)
    .DSum = Val(txtDSum)
    .UserName = MakeStr(txtUserName)
    .Status = "申请"
    .Reason = MakeStr(txtReason)
    '根据变量Modify的值,决定是插入新数据,还是修改已有的数据
    If Modify = False Then
      .Insert
    Else
      .Update (OriId)
    End If
  End With
  '关闭窗口
  Unload Me
End Sub

⌨️ 快捷键说明

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