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

📄 putbook.frm

📁 这是用VB做的一个很完善的图书管理系统
💻 FRM
📖 第 1 页 / 共 2 页
字号:
         EndProperty
         Enabled         =   0   'False
         Height          =   270
         Left            =   1200
         TabIndex        =   8
         Top             =   2760
         Width           =   1815
      End
      Begin VB.TextBox Text20 
         Enabled         =   0   'False
         Height          =   270
         Left            =   4080
         TabIndex        =   7
         Top             =   2760
         Width           =   1815
      End
      Begin VB.Label Label21 
         AutoSize        =   -1  'True
         Caption         =   "现存数量:"
         Height          =   180
         Left            =   6000
         TabIndex        =   46
         Top             =   2800
         Width           =   900
      End
      Begin VB.Label Label20 
         AutoSize        =   -1  'True
         Caption         =   "图书总数:"
         Height          =   180
         Left            =   3180
         TabIndex        =   45
         Top             =   2800
         Width           =   900
      End
      Begin VB.Label Label19 
         AutoSize        =   -1  'True
         Caption         =   "价    格:"
         Height          =   180
         Left            =   240
         TabIndex        =   44
         Top             =   2800
         Width           =   900
      End
      Begin VB.Label Label18 
         AutoSize        =   -1  'True
         Caption         =   "出版日期:"
         Height          =   180
         Left            =   6000
         TabIndex        =   43
         Top             =   2450
         Width           =   900
      End
      Begin VB.Label Label17 
         AutoSize        =   -1  'True
         Caption         =   "出 版 社:"
         Height          =   180
         Left            =   3180
         TabIndex        =   42
         Top             =   2450
         Width           =   900
      End
      Begin VB.Label Label16 
         AutoSize        =   -1  'True
         Caption         =   "作    者:"
         Height          =   180
         Left            =   240
         TabIndex        =   41
         Top             =   2450
         Width           =   900
      End
      Begin VB.Label Label15 
         AutoSize        =   -1  'True
         Caption         =   "类    别:"
         Height          =   180
         Left            =   6000
         TabIndex        =   40
         Top             =   2100
         Width           =   900
      End
      Begin VB.Label Label14 
         AutoSize        =   -1  'True
         Caption         =   "书    名:"
         Height          =   180
         Left            =   3180
         TabIndex        =   39
         Top             =   2100
         Width           =   900
      End
      Begin VB.Label Label13 
         AutoSize        =   -1  'True
         Caption         =   "图书编号:"
         ForeColor       =   &H00FF0000&
         Height          =   180
         Left            =   240
         TabIndex        =   38
         Top             =   2100
         Width           =   900
      End
      Begin VB.Label Label2 
         AutoSize        =   -1  'True
         Caption         =   "姓    名:"
         Height          =   180
         Left            =   3180
         TabIndex        =   36
         Top             =   280
         Width           =   900
      End
      Begin VB.Label Label3 
         AutoSize        =   -1  'True
         Caption         =   "性    别:"
         Height          =   180
         Left            =   6000
         TabIndex        =   35
         Top             =   280
         Width           =   900
      End
      Begin VB.Label Label5 
         AutoSize        =   -1  'True
         Caption         =   "单位部门:"
         Height          =   180
         Left            =   3180
         TabIndex        =   34
         Top             =   650
         Width           =   900
      End
      Begin VB.Label Label6 
         AutoSize        =   -1  'True
         Caption         =   "联系电话:"
         Height          =   180
         Left            =   6000
         TabIndex        =   33
         Top             =   650
         Width           =   900
      End
      Begin VB.Label Label8 
         AutoSize        =   -1  'True
         Caption         =   "登记日期:"
         Height          =   180
         Left            =   3180
         TabIndex        =   32
         Top             =   1020
         Width           =   900
      End
      Begin VB.Label Label9 
         AutoSize        =   -1  'True
         Caption         =   "借书次数:"
         Height          =   180
         Left            =   6000
         TabIndex        =   31
         Top             =   1020
         Width           =   900
      End
      Begin VB.Label Label11 
         AutoSize        =   -1  'True
         Caption         =   "未还书数:"
         Height          =   180
         Left            =   3180
         TabIndex        =   30
         Top             =   1390
         Width           =   900
      End
      Begin VB.Label Label12 
         AutoSize        =   -1  'True
         Caption         =   "备    注:"
         Height          =   180
         Left            =   6000
         TabIndex        =   29
         Top             =   1390
         Width           =   900
      End
      Begin VB.Line Line1 
         X1              =   240
         X2              =   9000
         Y1              =   1800
         Y2              =   1800
      End
      Begin VB.Label Label1 
         AutoSize        =   -1  'True
         Caption         =   "读者编号:"
         ForeColor       =   &H00FF0000&
         Height          =   180
         Left            =   240
         TabIndex        =   28
         Top             =   280
         Width           =   900
      End
      Begin VB.Label Label4 
         AutoSize        =   -1  'True
         Caption         =   "类    别:"
         Height          =   180
         Left            =   240
         TabIndex        =   27
         Top             =   650
         Width           =   900
      End
      Begin VB.Label Label7 
         AutoSize        =   -1  'True
         Caption         =   "住    址:"
         Height          =   180
         Left            =   240
         TabIndex        =   26
         Top             =   1020
         Width           =   900
      End
      Begin VB.Label Label10 
         AutoSize        =   -1  'True
         Caption         =   "可借书数:"
         Height          =   180
         Left            =   240
         TabIndex        =   25
         Top             =   1390
         Width           =   900
      End
   End
   Begin VB.Label Label24 
      BackColor       =   &H0080C0FF&
      Caption         =   $"putbook.frx":1A6D
      Height          =   1455
      Left            =   9120
      TabIndex        =   54
      Top             =   1920
      Width           =   2415
   End
End
Attribute VB_Name = "putbook"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim putbookcn As New ADODB.Connection
Dim putbookrsuser As New Recordset
Dim putbookrsuser1 As New Recordset
Dim putbookrsuser2 As New Recordset
Dim putbookrsuser3 As New ADODB.Recordset
Private Sub label25_Click()
Label13.Caption = "图书编号:"
Text24.Visible = False
Text13.Visible = True
Option1.Value = True
Label25.ForeColor = &HC0&
Label26.ForeColor = &H80000012
End Sub
Private Sub label26_Click()
Label13.Caption = "条 形 码:"
Text24.Visible = True
Text13.Visible = False
Option2.Value = True
Label25.ForeColor = &H80000012
Label26.ForeColor = &HC0&
End Sub
Private Sub Text24_GotFocus()
Text24.BackColor = &HFFC0C0
End Sub

Private Sub text24_LostFocus()
Text24.BackColor = &H80000014
End Sub
Private Sub Form_Unload(Cancel As Integer)
         main.Show
         main.Enabled = True
End Sub
Private Sub Option1_Click()
Label13.Caption = "图书编号:"
Text24.Visible = False
Text13.Visible = True
Label25.ForeColor = &HC0&
Label26.ForeColor = &H80000012
End Sub

Private Sub Option2_Click()
Label13.Caption = "条 形 码:"
Text24.Visible = True
Text13.Visible = False
Label25.ForeColor = &H80000012
Label26.ForeColor = &HC0&
End Sub
Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
    On Error Resume Next
    Set putbookcn = New Connection
    Dim strsql As String
    strsql = "select * from 借出图书资料 where 借书者编号 = " + Chr$(34) + Text1.Text + Chr$(34)
    strsql1 = "select * from duzhe where 编号 = " + Chr(34) + Text1.Text + Chr$(34)
    putbookcn.ConnectionString = "provider=Microsoft.Jet.OLEDB.3.51;data source=book.mdb;"
    putbookcn.CursorLocation = adUseClient
    putbookcn.Open

    Set putbookrsuser = New Recordset
    putbookrsuser.CursorLocation = adUseClient
    putbookrsuser.Open strsql, putbookcn, adOpenDynamic, adLockOptimistic
        putbookrsuserclose = 1

    
    Set DataGrid1.DataSource = putbookrsuser
    Set putbookrsuser1 = New Recordset
    putbookrsuser1.CursorLocation = adUseClient
    putbookrsuser1.Open strsql1, putbookcn, adOpenDynamic, adLockOptimistic
    Set Text2.DataSource = putbookrsuser1
        Text2.DataField = "姓名"
    Set Text3.DataSource = putbookrsuser1
        Text3.DataField = "性别"
    Set Text4.DataSource = putbookrsuser1
        Text4.DataField = "类别"
    Set Text5.DataSource = putbookrsuser1
        Text5.DataField = "单位部门"
    Set Text6.DataSource = putbookrsuser1
        Text6.DataField = "联系电话"
    Set Text7.DataSource = putbookrsuser1
        Text7.DataField = "住址"
    Set Text8.DataSource = putbookrsuser1
        Text8.DataField = "登记日期"
    Set Text9.DataSource = putbookrsuser1
        Text9.DataField = "借书次数"
    Set Text10.DataSource = putbookrsuser1
        Text10.DataField = "可借书数"
    Set Text11.DataSource = putbookrsuser1
        Text11.DataField = "未还书数"
    Set Text12.DataSource = putbookrsuser1
        Text12.DataField = "备注"

End If
End Sub
Private Sub Text13_KeyPress(KeyAscii As Integer)
If Text2.Text = "" Then
    nul = MsgBox("请先选择读者!", vbOKOnly + vbInformation, "提示:")
    Text13.Text = ""
Else
    If KeyAscii = 13 Then
       On Error Resume Next
       Set putbookcn = New Connection
       Dim strsql As String
       Dim strsql1 As String
       If Label13.Caption = "图书编号:" Then
          strsql = "select * from book where 图书编号 = " + Chr$(34) + Text13.Text + Chr$(34)
          strsql1 = "select * from 借出图书资料 where 借书者 = " + Chr$(34) + Text2.Text + Chr$(34) + " and 图书编号 = " + Chr$(34) + Text13.Text + Chr$(34)
       Else
          strsql = "select * from book where 条形码 = " + Chr(34) + Text13.Text + Chr$(34)
          strsql1 = "select * from 借出图书资料 where 借书者 = " + Chr$(34) + Text2.Text + Chr$(34) + " and 条形码 = " + Chr(34) + Text13.Text + Chr$(34)
       End If
       putbookcn.ConnectionString = "provider=Microsoft.Jet.OLEDB.3.51;data source=book.mdb;"
       putbookcn.CursorLocation = adUseClient
       putbookcn.Open
    putbookrsuser3.Open strsql1, putbookcn, adOpenDynamic, adLockOptimistic
    Set DataGrid1.DataSource = putbookrsuser3
    Set Text23.DataSource = putbookrsuser3
    Text23.DataField = "借书日期"
    Set Text22.DataSource = putbookrsuser3
    Text22.DataField = "应还日期"
    
    Set putbookrsuser2 = New Recordset
    putbookrsuser2.CursorLocation = adUseClient
    putbookrsuser2.Open strsql, putbookcn, adOpenDynamic, adLockOptimistic
    If Label13.Caption = "图书编号:" Then
       Set Text24.DataSource = putbookrsuser2
           Text24.DataField = "条形码"
    Else
       Set Text13.DataSource = putbookrsuser2
           Text13.DataField = "图书编号"
    End If
    Set Text14.DataSource = putbookrsuser2
        Text14.DataField = "书名"
    Set Text15.DataSource = putbookrsuser2
        Text15.DataField = "类别"
    Set Text16.DataSource = putbookrsuser2
        Text16.DataField = "作者"
    Set Text17.DataSource = putbookrsuser2
        Text17.DataField = "出版社"
    Set Text18.DataSource = putbookrsuser2
        Text18.DataField = "出版时间"
    Set Text19.DataSource = putbookrsuser2
        Text19.DataField = "图书价格"
    Set Text20.DataSource = putbookrsuser2
        Text20.DataField = "图书总数"
    Set Text21.DataSource = putbookrsuser2
        Text21.DataField = "现存数量"
    If putbookrsuser3.RecordCount = 0 Then
       nul = MsgBox("您没有借过此书!", vbOKOnly, "对不起!")
    End If
End If
End If
End Sub
Private Sub Toolbar1_ButtonClick(ByVal Button As MSComctlLib.Button)
On Error Resume Next
Select Case Button.Key
    Case "关闭"
         Unload Me
         main.Show
         main.Enabled = True
         putbookrsuser.Close
         putbookrsuser1.Close
         putbookrsuser2.Close
         putbookrsuser3.Close
         
    Case "还书"
    If Text2.Text <> "" And Text14.Text <> "" Then
         If putbookrsuser3.RecordCount = 0 Then
            nul = MsgBox("你并没有借这本书!", vbOKOnly, "对不起!")
         Else
               putbookrsuser3.Delete
               putbookrsuser3.Update
               Text10.Text = Val(Text10.Text) + 1
               Text11.Text = Val(Text11.Text) + 1
               putbookrsuser1("可借书数") = Text10.Text
               putbookrsuser1("未还书数") = Text11.Text
               putbookrsuser1.UpdateBatch
               Text21.Text = Val(Text21.Text) + 1
               putbookrsuser2("现存数量") = Text21.Text
               putbookrsuser2.UpdateBatch
            End If
    End If
    
    Case "清空"
    If putbookrsuser.State Then '.state为当前记录状态
         putbookrsuser.Close
         putbookrsuser1.Close
         putbookrsuser2.Close
         putbookrsuser3.Close
    End If
End Select
End Sub

Private Sub Text1_GotFocus()
Text1.BackColor = &HFFC0C0
End Sub

Private Sub Text1_LostFocus()
Text1.BackColor = &H80000014
End Sub

Private Sub Text13_GotFocus()
Text13.BackColor = &HFFC0C0
End Sub

Private Sub Text13_LostFocus()
Text13.BackColor = &H80000014
End Sub

⌨️ 快捷键说明

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