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

📄 frmcardtypeedit.frm

📁 vb与access数据库的操作实例
💻 FRM
字号:
VERSION 5.00
Begin VB.Form FrmCardTypeEdit 
   Caption         =   "编辑借阅证类型"
   ClientHeight    =   2895
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   3555
   Icon            =   "FrmCardTypeEdit.frx":0000
   LinkTopic       =   "Form1"
   ScaleHeight     =   2895
   ScaleWidth      =   3555
   StartUpPosition =   2  '屏幕中心
   Begin VB.TextBox txtAddDays 
      Alignment       =   1  'Right Justify
      Height          =   375
      Left            =   1560
      TabIndex        =   8
      Text            =   "30"
      Top             =   1680
      Width           =   1695
   End
   Begin VB.CommandButton Cmd_Cancel 
      Caption         =   "取 消"
      Height          =   375
      Left            =   1890
      TabIndex        =   7
      Top             =   2280
      Width           =   975
   End
   Begin VB.CommandButton Cmd_OK 
      Caption         =   "确 定"
      Height          =   375
      Left            =   690
      TabIndex        =   6
      Top             =   2280
      Width           =   975
   End
   Begin VB.TextBox txtMaxDays 
      Alignment       =   1  'Right Justify
      Height          =   375
      Left            =   1560
      TabIndex        =   5
      Text            =   "100"
      Top             =   1155
      Width           =   1695
   End
   Begin VB.TextBox txtMaxCount 
      Alignment       =   1  'Right Justify
      Height          =   375
      Left            =   1560
      TabIndex        =   4
      Text            =   "10"
      Top             =   660
      Width           =   1695
   End
   Begin VB.TextBox txtTypeName 
      Height          =   375
      Left            =   1560
      TabIndex        =   3
      Top             =   165
      Width           =   1695
   End
   Begin VB.Label Label4 
      AutoSize        =   -1  'True
      Caption         =   "续借天数"
      Height          =   180
      Left            =   600
      TabIndex        =   9
      Top             =   1725
      Width           =   720
   End
   Begin VB.Label Label3 
      AutoSize        =   -1  'True
      Caption         =   "最多借阅天数"
      Height          =   180
      Left            =   240
      TabIndex        =   2
      Top             =   1200
      Width           =   1080
   End
   Begin VB.Label Label2 
      AutoSize        =   -1  'True
      Caption         =   "最大借阅数量"
      Height          =   180
      Left            =   240
      TabIndex        =   1
      Top             =   720
      Width           =   1080
   End
   Begin VB.Label Label1 
      AutoSize        =   -1  'True
      Caption         =   "类型名称"
      Height          =   180
      Left            =   600
      TabIndex        =   0
      Top             =   240
      Width           =   720
   End
End
Attribute VB_Name = "FrmCardTypeEdit"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Public tId As Long
Public Modify As Boolean '插入=false,修改=true

Private Sub Cmd_Cancel_Click()
  Unload Me
End Sub

Private Sub Cmd_OK_Click()
  '检查用户录入数据的有效性
  If Len(Trim(txtTypeName)) = 0 Then
    MsgBox "请输入借阅证类型名称!"
    txtTypeName.SetFocus
    txtTypeName.SelStart = 0
    txtTypeName.SelLength = Len(txtTypeName)
    Exit Sub
  End If
  If Val(txtMaxCount) <= 0 Then
    MsgBox "请输入最大借阅数量"
    txtMaxCount.SetFocus
    txtMaxCount.SelStart = 0
    txtMaxCount.SelLength = Len(txtMaxCount)
    Exit Sub
  End If
  If Val(txtMaxDays) <= 0 Then
    MsgBox "请输入最多借阅天数"
    txtMaxDays.SetFocus
    txtMaxDays.SelStart = 0
    txtMaxDays.SelLength = Len(txtMaxDays)
    Exit Sub
  End If
  If Val(txtAddDays) <= 0 Then
    MsgBox "请输入允许续借天数"
    txtAddDays.SetFocus
    txtAddDays.SelStart = 0
    txtAddDays.SelLength = Len(txtAddDays)
    Exit Sub
  End If
  '把用户录入的数据赋值到数据库对象变量中
  With MyCardType
  .TypeName = MakeStr(txtTypeName)
  .MaxCount = Val(txtMaxCount)
  .MaxDays = Val(txtMaxDays)
  .AddDays = Val(txtAddDays)
  '根据变量Modify的值,决定是插入新数据,还是修改已有的数据
  If Modify = False Then
    .Insert
  Else
    Call .Update(tId)
  End If
  End With
  MsgBox "保存成功"
  '关闭窗口
  Unload Me
End Sub

⌨️ 快捷键说明

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