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

📄

📁 vb模拟 图书管理系统
💻
字号:
VERSION 5.00
Begin VB.Form 读者登记1 
   BorderStyle     =   1  'Fixed Single
   Caption         =   "编辑读者记录"
   ClientHeight    =   4020
   ClientLeft      =   45
   ClientTop       =   435
   ClientWidth     =   4680
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   4020
   ScaleWidth      =   4680
   StartUpPosition =   2  '屏幕中心
   Begin VB.Frame Frame1 
      Caption         =   "读者记录"
      Height          =   3735
      Left            =   120
      TabIndex        =   0
      Top             =   120
      Width           =   4455
      Begin VB.CommandButton Command4 
         Caption         =   "…"
         Height          =   255
         Left            =   4080
         TabIndex        =   16
         Top             =   960
         Width           =   255
      End
      Begin VB.TextBox Text6 
         Height          =   270
         Left            =   1080
         TabIndex        =   22
         Top             =   2760
         Width           =   975
      End
      Begin VB.ComboBox Combo2 
         Height          =   300
         Left            =   2280
         TabIndex        =   15
         Top             =   960
         Width           =   1815
      End
      Begin VB.CommandButton Command2 
         Caption         =   "取消"
         Height          =   255
         Left            =   2400
         TabIndex        =   24
         Top             =   3240
         Width           =   855
      End
      Begin VB.CommandButton Command1 
         Caption         =   "确定"
         Height          =   255
         Left            =   600
         TabIndex        =   23
         Top             =   3240
         Width           =   855
      End
      Begin VB.TextBox Text3 
         Height          =   270
         Left            =   1080
         TabIndex        =   19
         Top             =   2160
         Width           =   375
      End
      Begin VB.TextBox Text2 
         Height          =   270
         Left            =   3000
         TabIndex        =   12
         Top             =   360
         Width           =   1335
      End
      Begin VB.TextBox Text1 
         Height          =   270
         Left            =   960
         TabIndex        =   11
         Top             =   360
         Width           =   1335
      End
      Begin VB.Frame Frame3 
         Caption         =   "级别"
         Height          =   1095
         Left            =   120
         TabIndex        =   7
         Top             =   1440
         Width           =   4215
         Begin VB.CommandButton Command3 
            Caption         =   "…"
            BeginProperty Font 
               Name            =   "宋体"
               Size            =   12
               Charset         =   134
               Weight          =   700
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   240
            Left            =   1800
            TabIndex        =   18
            Top             =   240
            Width           =   255
         End
         Begin VB.ComboBox Combo1 
            Height          =   300
            Left            =   240
            TabIndex        =   17
            Top             =   240
            Width           =   1575
         End
         Begin VB.TextBox Text5 
            Height          =   270
            Left            =   3600
            TabIndex        =   21
            Text            =   "30"
            Top             =   720
            Width           =   375
         End
         Begin VB.TextBox Text4 
            Height          =   270
            Left            =   2280
            TabIndex        =   20
            Text            =   "10"
            Top             =   720
            Width           =   375
         End
         Begin VB.Label Label8 
            Caption         =   "借书天数"
            Height          =   255
            Left            =   2760
            TabIndex        =   10
            Top             =   720
            Width           =   735
         End
         Begin VB.Label Label7 
            Caption         =   "借书总数"
            Height          =   255
            Left            =   1440
            TabIndex        =   9
            Top             =   720
            Width           =   735
         End
         Begin VB.Label Label6 
            Caption         =   "过期罚款"
            Height          =   255
            Left            =   120
            TabIndex        =   8
            Top             =   720
            Width           =   735
         End
      End
      Begin VB.Frame Frame2 
         Caption         =   "性 别"
         Height          =   615
         Left            =   120
         TabIndex        =   6
         Top             =   720
         Width           =   1335
         Begin VB.OptionButton Option2 
            Caption         =   "女"
            Height          =   255
            Left            =   720
            TabIndex        =   14
            Top             =   240
            Width           =   495
         End
         Begin VB.OptionButton Option1 
            Caption         =   "男"
            Height          =   255
            Left            =   120
            TabIndex        =   13
            Top             =   240
            Value           =   -1  'True
            Width           =   495
         End
      End
      Begin VB.Label Label5 
         Caption         =   "<-日期格式:2001-9-1"
         Height          =   255
         Left            =   2280
         TabIndex        =   5
         Top             =   2760
         Width           =   1935
      End
      Begin VB.Label Label4 
         Caption         =   "登记日期*"
         Height          =   255
         Left            =   120
         TabIndex        =   4
         Top             =   2760
         Width           =   855
      End
      Begin VB.Label Label3 
         Caption         =   "单位*"
         Height          =   255
         Left            =   1680
         TabIndex        =   3
         Top             =   960
         Width           =   495
      End
      Begin VB.Label Label2 
         Caption         =   "姓名*"
         Height          =   255
         Left            =   2520
         TabIndex        =   2
         Top             =   360
         Width           =   495
      End
      Begin VB.Label Label1 
         Caption         =   "借书证号*"
         Height          =   255
         Left            =   120
         TabIndex        =   1
         Top             =   360
         Width           =   855
      End
   End
End
Attribute VB_Name = "读者登记1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False

Private Sub combo1_keypress(KeyAscii As Integer)
Call endata(KeyAscii)
End Sub

Private Sub combo2_keypress(KeyAscii As Integer)
Call endata(KeyAscii)
End Sub

Private Sub Command1_Click() '确定
If Trim(Text1.Text) = "" Or Trim(Text2.Text) = "" _
Or Trim(Text6.Text) = "" Or Trim(Combo1.Text) = "" Then
MsgBox "加*数据不能为空,请重新设置", vbOKOnly, "信息提示"
Exit Sub
End If
sqltxt = "select * from reader where 借书证号='" + _
Trim(Text1.Text) + "'" '对reader中记录进行判断
Set rs = exesql(sqltxt)
If flag = 1 Then '添加操作,先判断是否存在相同借书证号的读者
If rs.RecordCount <> 0 Then
MsgBox "存在相同的借书证号", vbOKOnly, "信息提示"
Text1.SetFocus
rs.Close
Exit Sub
End If
rs.AddNew
rs.Fields("借书证号") = Trim(Text1.Text)
rs.Fields("姓名") = Trim(Text2.Text)
If Option1.Value = True Then
rs.Fields("性别") = "男"
Else
rs.Fields("性别") = "女"
End If
rs.Fields("级别") = Trim(Combo1.Text)
rs.Fields("单位") = Trim(Combo2.Text)
rs.Fields("过期罚款") = Trim(Text3.Text)
rs.Fields("借书总数") = Val(Trim(Text4.Text))
rs.Fields("借书天数") = Val(Trim(Text5.Text))
rs.Fields("已借书数") = 0
rs.Fields("登记日期") = Format(Trim(Text6.Text), "yyyy-mm-dd")
rs.Update
recs = recs + 1
Else '修改操作,判断是否存在相同借书证号的读者
rs.Fields("借书证号") = Trim(Text1.Text)
rs.Fields("姓名") = Trim(Text2.Text)
If Option1.Value = True Then
rs.Fields("性别") = "男"
Else
rs.Fields("性别") = "女"
End If
rs.Fields("级别") = Trim(Combo1.Text)
rs.Fields("单位") = Trim(Combo2.Text)
rs.Fields("过期罚款") = Trim(Text3.Text)
rs.Fields("借书总数") = Val(Trim(Text4.Text))
rs.Fields("借书天数") = Val(Trim(Text5.Text))
rs.Fields("已借书数") = 0
rs.Fields("登记日期") = Format(Trim(Text6.Text), "yyyy-mm-dd")
rs.Update
End If
Unload Me
End Sub

Private Sub Command2_Click()
Unload Me
xnum = ""
End Sub

Private Sub Command3_Click()
添加级别.Show vbModal '以模式方式调用edrec窗体编辑读者级别记录
End Sub

Private Sub Command4_Click()
tna = "depart"
cap = "单位"
编辑信息.Show vbModal '以模式方式调用edrec窗体编号单位记录
End Sub

Private Sub Form_Load()
Dim sqltxt As String
Dim sqltxt1 As String
Dim i As Integer
sqltxt = "select * from rlevel "
Set rs = exesql(sqltxt)
'Combo1.Text = rs.Fields("级别")
For i = 1 To rs.RecordCount
Combo1.AddItem rs.Fields("级别")
rs.MoveNext
Next i
sqltxt = "select * from depart "
Set rs = exesql(sqltxt)
'Combo2.Text = rs.Fields("fn")
For i = 1 To rs.RecordCount
Combo2.AddItem rs.Fields("fn")
rs.MoveNext
Next i
If flag = 2 Then '修改操作
Text1.Text = xnum
sqltxt1 = "select * from reader where 借书证号='" + xnum + "'"
Set brs = exesql(sqltxt1)
Text2.Text = brs.Fields("姓名")
Text3.Text = brs.Fields("过期罚款")
Text4.Text = brs.Fields("借书总数")
Text5.Text = brs.Fields("借书天数")
Text6.Text = brs.Fields("登记日期")
If brs.Fields("性别") = "男" Then
Option1.Value = True
Else
Option2.Value = True
End If
Combo1.Text = brs.Fields("级别")
Combo2.Text = brs.Fields("单位")
Text1.Enabled = False
Else
Text6.Text = Date '添加操作
End If
End Sub

Private Sub Form_Unload(Cancel As Integer)
xnum = ""
End Sub

Private Sub Text1_KeyPress(KeyAscii As Integer)
Call endata(KeyAscii)
End Sub

⌨️ 快捷键说明

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