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

📄 edbook1.frm

📁 简单的图书管理系统
💻 FRM
字号:
VERSION 5.00
Begin VB.Form edbook1 
   Caption         =   "编辑图书记录"
   ClientHeight    =   6405
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   8325
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   6405
   ScaleWidth      =   8325
   StartUpPosition =   2  '屏幕中心
   Begin VB.Frame Frame1 
      Caption         =   "图书记录"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   12
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H8000000D&
      Height          =   5295
      Left            =   600
      TabIndex        =   0
      Top             =   480
      Width           =   7095
      Begin VB.CommandButton Command2 
         Caption         =   "取消"
         Height          =   375
         Left            =   5400
         TabIndex        =   17
         Top             =   2040
         Width           =   735
      End
      Begin VB.CommandButton Command1 
         Caption         =   "确定"
         Height          =   375
         Left            =   5400
         TabIndex        =   16
         Top             =   1320
         Width           =   735
      End
      Begin VB.TextBox Text7 
         Height          =   375
         Left            =   1800
         TabIndex        =   14
         Text            =   "Text7"
         Top             =   4080
         Width           =   1575
      End
      Begin VB.TextBox Text6 
         Height          =   375
         Left            =   1800
         TabIndex        =   13
         Text            =   "Text6"
         Top             =   3480
         Width           =   1575
      End
      Begin VB.TextBox Text5 
         Height          =   375
         Left            =   1800
         TabIndex        =   12
         Text            =   "Text5"
         Top             =   2880
         Width           =   1575
      End
      Begin VB.TextBox Text4 
         Height          =   375
         Left            =   1800
         TabIndex        =   11
         Text            =   "Text4"
         Top             =   2280
         Width           =   2175
      End
      Begin VB.TextBox Text3 
         Height          =   375
         Left            =   1800
         TabIndex        =   10
         Text            =   "Text3"
         Top             =   1680
         Width           =   2175
      End
      Begin VB.TextBox Text2 
         Height          =   375
         Left            =   1800
         TabIndex        =   9
         Text            =   "Text2"
         Top             =   1080
         Width           =   2175
      End
      Begin VB.TextBox Text1 
         Height          =   375
         Left            =   1800
         TabIndex        =   8
         Text            =   "Text1"
         Top             =   480
         Width           =   2175
      End
      Begin VB.Label Label8 
         AutoSize        =   -1  'True
         Caption         =   "格式:yy-mm-dd"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   12
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H8000000D&
         Height          =   240
         Left            =   3720
         TabIndex        =   15
         Top             =   4080
         Width           =   1680
      End
      Begin VB.Label Label7 
         AutoSize        =   -1  'True
         Caption         =   "入库日期*"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   12
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H8000000D&
         Height          =   240
         Left            =   480
         TabIndex        =   7
         Top             =   4200
         Width           =   1080
      End
      Begin VB.Label Label6 
         AutoSize        =   -1  'True
         Caption         =   "定价"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   12
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H8000000D&
         Height          =   240
         Left            =   480
         TabIndex        =   6
         Top             =   3600
         Width           =   480
      End
      Begin VB.Label Label5 
         AutoSize        =   -1  'True
         BackStyle       =   0  'Transparent
         Caption         =   "出版社"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   12
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H8000000D&
         Height          =   240
         Left            =   480
         TabIndex        =   5
         Top             =   3000
         Width           =   720
      End
      Begin VB.Label Label4 
         AutoSize        =   -1  'True
         Caption         =   "作者"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   12
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H8000000D&
         Height          =   240
         Left            =   480
         TabIndex        =   4
         Top             =   2400
         Width           =   480
      End
      Begin VB.Label Label3 
         AutoSize        =   -1  'True
         Caption         =   "书名*"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   12
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H8000000D&
         Height          =   240
         Left            =   480
         TabIndex        =   3
         Top             =   1800
         Width           =   600
      End
      Begin VB.Label Label2 
         AutoSize        =   -1  'True
         Caption         =   "分类号"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   12
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H8000000D&
         Height          =   240
         Left            =   480
         TabIndex        =   2
         Top             =   1080
         Width           =   720
      End
      Begin VB.Label Label1 
         AutoSize        =   -1  'True
         Caption         =   "图书编号*"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   12
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H8000000D&
         Height          =   240
         Left            =   480
         TabIndex        =   1
         Top             =   480
         Width           =   1080
      End
   End
End
Attribute VB_Name = "edbook1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim rs As ADODB.Recordset

Private Sub Command1_Click()
If Trim(Text1.Text) = "" Or Trim(Text3.Text) = "" Or Trim(Text7.Text) = "" Then
    MsgBox "加*项不能为空!", vbOKOnly, , "信息提示"
    Exit Sub
End If
If flag = 1 Then
    sqltxt = "select * from book where 图书编号='" + Trim(Text1.Text) + "'"
    Set rs = exesql(sqltxt)
    If rs.RecordCount <> 0 Then
        MsgBox "存在相同的图书编号", vbOKOnly, "信息提示"
        Text1.SetFocus
        Exit Sub
    Else
        rs.Close
    End If
    edbook.Adodc1.Recordset.AddNew
    edbook.Adodc1.Recordset.Fields("图书编号") = Trim(Text1.Text)
    edbook.Adodc1.Recordset.Fields("分类号") = Trim(Text2.Text)
    edbook.Adodc1.Recordset.Fields("书名") = Trim(Text3.Text)
    edbook.Adodc1.Recordset.Fields("作者") = Trim(Text4.Text)
    edbook.Adodc1.Recordset.Fields("出版社") = Trim(Text5.Text)
    edbook.Adodc1.Recordset.Fields("定价") = Trim(Text6.Text)
    edbook.Adodc1.Recordset.Fields("入库日期") = Format(Trim(Text7.Text), "yyyy-mm-dd")
    edbook.Adodc1.Recordset.Fields("借否") = "否"
    edbook.Adodc1.Recordset.Update
    recs = recs - 1
Else
    edbook.Adodc1.Recordset.Fields("图书编号") = Trim(Text1.Text)
    edbook.Adodc1.Recordset.Fields("分类号") = Trim(Text2.Text)
    edbook.Adodc1.Recordset.Fields("书名") = Trim(Text3.Text)
    edbook.Adodc1.Recordset.Fields("作者") = Trim(Text4.Text)
    edbook.Adodc1.Recordset.Fields("出版社") = Trim(Text5.Text)
    edbook.Adodc1.Recordset.Fields("定价") = Trim(Text6.Text)
    edbook.Adodc1.Recordset.Fields("入库日期") = Format(Trim(Text7.Text), "yyyy-mm-dd")
    edbook.Adodc1.Recordset.Update
End If
Unload Me

End Sub

Private Sub Command2_Click()
    Unload Me
    
End Sub

Private Sub Form_Load()
    Text1.Text = ""
    Text2.Text = ""
    Text3.Text = ""
    Text4.Text = ""
    Text5.Text = ""
    Text6.Text = ""
    Text7.Text = ""
If flag = 2 Then
    Text1.Text = edbook.Adodc1.Recordset.Fields("图书编号") & ""
    Text2.Text = edbook.Adodc1.Recordset.Fields("分类号") & ""
    Text3.Text = edbook.Adodc1.Recordset.Fields("书名") & ""
    Text4.Text = edbook.Adodc1.Recordset.Fields("作者") & ""
    Text5.Text = edbook.Adodc1.Recordset.Fields("出版社") & ""
    Text6.Text = edbook.Adodc1.Recordset.Fields("定价") & ""
    Text7.Text = edbook.Adodc1.Recordset.Fields("入库日期") & ""
    Text1.Enabled = False
Else
    Text7.Text = Date
End If

End Sub

Private Sub text_KeyPress(Index As Integer, KeyAscii As Integer)
    Call endata(KeyAscii)
End Sub

⌨️ 快捷键说明

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