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

📄 frmstoreinedit.frm

📁 vb与access数据库的操作实例
💻 FRM
字号:
VERSION 5.00
Begin VB.Form FrmStoreInEdit 
   BorderStyle     =   1  'Fixed Single
   Caption         =   "编辑图书入库信息"
   ClientHeight    =   3570
   ClientLeft      =   45
   ClientTop       =   330
   ClientWidth     =   6135
   Icon            =   "FrmStoreInEdit.frx":0000
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   3570
   ScaleWidth      =   6135
   StartUpPosition =   2  '屏幕中心
   Begin VB.Frame Frame2 
      Caption         =   "图书信息"
      Height          =   1335
      Left            =   120
      TabIndex        =   11
      Top             =   120
      Width           =   5895
      Begin VB.TextBox txtTotal 
         Enabled         =   0   'False
         Height          =   330
         Left            =   4440
         TabIndex        =   18
         Top             =   760
         Width           =   1335
      End
      Begin VB.TextBox txtBookName 
         Enabled         =   0   'False
         Height          =   330
         Left            =   1200
         TabIndex        =   16
         Top             =   760
         Width           =   2055
      End
      Begin VB.CommandButton Cmd_SelBook 
         Caption         =   "选择图书"
         Height          =   375
         Left            =   4800
         TabIndex        =   14
         Top             =   240
         Width           =   975
      End
      Begin VB.TextBox txtBookNo 
         Enabled         =   0   'False
         Height          =   330
         Left            =   1200
         TabIndex        =   13
         Top             =   300
         Width           =   2055
      End
      Begin VB.Label Label2 
         AutoSize        =   -1  'True
         Caption         =   "当前库存"
         Height          =   180
         Left            =   3480
         TabIndex        =   17
         Top             =   840
         Width           =   720
      End
      Begin VB.Label Label1 
         AutoSize        =   -1  'True
         Caption         =   "图书名称"
         Height          =   180
         Left            =   240
         TabIndex        =   15
         Top             =   840
         Width           =   720
      End
      Begin VB.Label Label8 
         AutoSize        =   -1  'True
         BackColor       =   &H00FFC0C0&
         BackStyle       =   0  'Transparent
         Caption         =   "书    号"
         Height          =   180
         Left            =   240
         TabIndex        =   12
         Top             =   360
         Width           =   720
      End
   End
   Begin VB.CommandButton Cmd_OK 
      Caption         =   "确 定"
      Default         =   -1  'True
      Height          =   400
      Left            =   1575
      MousePointer    =   99  'Custom
      Style           =   1  'Graphical
      TabIndex        =   3
      Top             =   3000
      Width           =   1300
   End
   Begin VB.CommandButton Cmd_Cancel 
      Cancel          =   -1  'True
      Caption         =   "取 消"
      Height          =   400
      Left            =   3615
      MousePointer    =   99  'Custom
      Style           =   1  'Graphical
      TabIndex        =   4
      Top             =   3000
      Width           =   1300
   End
   Begin VB.Frame Frame1 
      Caption         =   "入库信息"
      Height          =   1215
      Left            =   120
      TabIndex        =   5
      Top             =   1560
      Width           =   5895
      Begin VB.TextBox txtCreateDate 
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   9
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   330
         Left            =   4440
         MaxLength       =   20
         TabIndex        =   8
         Top             =   720
         Width           =   1335
      End
      Begin VB.TextBox txtPrice 
         Alignment       =   1  'Right Justify
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   9
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   330
         Left            =   4440
         MaxLength       =   50
         TabIndex        =   1
         Text            =   "0"
         Top             =   240
         Width           =   1335
      End
      Begin VB.TextBox txtUserName 
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   9
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   330
         Left            =   1200
         MaxLength       =   20
         TabIndex        =   2
         Top             =   720
         Width           =   1335
      End
      Begin VB.TextBox txtStoreCount 
         Alignment       =   1  'Right Justify
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   9
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   330
         Left            =   1200
         MaxLength       =   100
         TabIndex        =   0
         Text            =   "0"
         Top             =   240
         Width           =   1335
      End
      Begin VB.Label Label5 
         AutoSize        =   -1  'True
         BackStyle       =   0  'Transparent
         Caption         =   "入库数量"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   9
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H00000000&
         Height          =   180
         Left            =   240
         TabIndex        =   10
         Top             =   360
         Width           =   720
      End
      Begin VB.Label Label3 
         BackStyle       =   0  'Transparent
         Caption         =   "入库日期"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   9
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H00000000&
         Height          =   180
         Left            =   3480
         TabIndex        =   9
         Top             =   840
         Width           =   720
      End
      Begin VB.Label Label4 
         AutoSize        =   -1  'True
         BackStyle       =   0  'Transparent
         Caption         =   "图书单价"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   9
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H00000000&
         Height          =   180
         Left            =   3480
         TabIndex        =   7
         Top             =   360
         Width           =   720
      End
      Begin VB.Label Label6 
         AutoSize        =   -1  'True
         BackStyle       =   0  'Transparent
         Caption         =   "经 办 人"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   9
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H00000000&
         Height          =   180
         Left            =   240
         TabIndex        =   6
         Top             =   720
         Width           =   720
      End
   End
End
Attribute VB_Name = "FrmStoreInEdit"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Public Modify As Boolean '插入=false,修改=true
Public OriNo As Long  '入库编号

Private Sub Cmd_Cancel_Click()
  Unload Me
End Sub

Private Sub Cmd_OK_Click()
  '检查用户录入数据的有效性
  If Len(Trim(txtPrice)) = 0 Then
    MsgBox "请输入图书入库单价!"
    txtPrice.SetFocus
    txtPrice.SelStart = 0
    txtPrice.SelLength = Len(txtPrice)
    Exit Sub
  End If
  If Len(Trim(txtStoreCount)) = 0 Then
    MsgBox "请输入入库数量"
    txtStoreCount.SetFocus
    txtStoreCount.SelStart = 0
    txtStoreCount.SelLength = Len(txtStoreCount)
    Exit Sub
  End If
  If Len(Trim(txtBookNo)) = 0 Then
    MsgBox "请选择入库图书"
    Cmd_SelBook.SetFocus
    Exit Sub
  End If

  '把用户录入的数据赋值到数据库对象变量中
  With MyStoreIn
    .BookNo = MakeStr(txtBookNo)
    .StoreCount = Val(txtStoreCount)
    .Price = Val(txtPrice)
    .UserName = MakeStr(txtUserName)
    .CreateDate = MakeStr(txtCreateDate)
    If Modify = False Then
      .Insert
    Else
      .Update (OriNo)
    End If
  End With
  MsgBox "保存成功"
  '关闭窗口
  Unload Me
End Sub

Private Sub Cmd_SelBook_Click()
  '选择图书
  FrmBookSel.Show 1
  txtBookNo = Trim(SelBookInfo.BookNo)
  txtBookName = Trim(SelBookInfo.BookName)
  txtTotal = Val(SelBookInfo.Total)
End Sub

⌨️ 快捷键说明

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