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

📄 frmborrow.frm

📁 图书管理系统阿
💻 FRM
📖 第 1 页 / 共 2 页
字号:
         Width           =   1215
      End
   End
   Begin VB.Frame Frame1 
      Caption         =   "借阅人"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   11.25
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   855
      Left            =   120
      TabIndex        =   7
      Top             =   120
      Width           =   6735
      Begin VB.TextBox txtPNo 
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   11.25
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   375
         Left            =   720
         TabIndex        =   0
         Top             =   240
         Width           =   1215
      End
      Begin VB.TextBox txtDepartment 
         Enabled         =   0   'False
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   11.25
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   375
         Left            =   4560
         TabIndex        =   11
         Top             =   240
         Width           =   1815
      End
      Begin VB.TextBox txtPName 
         Enabled         =   0   'False
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   11.25
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   375
         Left            =   2640
         TabIndex        =   9
         Top             =   240
         Width           =   975
      End
      Begin VB.Label Label4 
         Caption         =   "部门:"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   11.25
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   375
         Left            =   3960
         TabIndex        =   12
         Top             =   360
         Width           =   1215
      End
      Begin VB.Label Label3 
         Caption         =   "姓名:"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   11.25
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   375
         Left            =   2040
         TabIndex        =   10
         Top             =   360
         Width           =   1215
      End
      Begin VB.Label Label2 
         Caption         =   "编号:"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   11.25
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   375
         Left            =   120
         TabIndex        =   8
         Top             =   360
         Width           =   1215
      End
   End
   Begin VB.CommandButton cmdExit 
      Caption         =   "退出(&X)"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   11.25
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   495
      Left            =   6000
      TabIndex        =   6
      Top             =   3600
      Width           =   1215
   End
End
Attribute VB_Name = "frmBorrow"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim cnn As New ADODB.Connection
Dim rst As New ADODB.Recordset

Private Sub cmdAdd_Click()
    Dim BookNo As String
    BookNo = txtBNo.Text
    For i = 0 To lstBook.ListCount - 1
        If lstBook.List(i) = BookNo Then
            MsgBox "该书已经选择", , "信息"
            txtBNo.SetFocus
            Exit Sub
        End If
    Next
    lstBook.AddItem BookNo
    txtBNo.SetFocus
End Sub

Private Sub cmdCancel_Click()
 txtPNo.Text = ""
 txtBNo.Text = ""
End Sub

Private Sub cmdDelete_Click()
    lstBook.RemoveItem lstBook.ListIndex
    txtBNo.SetFocus
End Sub

Private Sub cmdExit_Click()
    Unload Me
End Sub

Private Sub cmdOK_Click()
    Dim yn
    Dim pstr As String, cnnstr As String
    If lstBook.ListCount < 0 Then Exit Sub
    If lstBook.ListIndex = -1 Then
      yn = MsgBox("请选择借阅图书的编号", 36, "信息")
          
        Exit Sub
       End If
    Dim rststr As String
    rststr = "select * from borrow where ( borrow.BNo='" & lstBook.List(lstBook.ListIndex) & "') and (borrow.PNo='" & txtPNo.Text & "'and [to]=Null) "
    rst.Open rststr, cnn, adOpenKeyset, adLockOptimistic, adCmdText
    If rst.RecordCount >= 1 Then
       MsgBox "该书已经被借阅", , "信息"
       rst.Close
       Exit Sub
     Else
     rst.Close
    End If
    pstr = "insert into borrow([PNo],[BNo],[From]) values('" & txtPNo.Text & "','"
        cnnstr = pstr & lstBook.List(lstBook.ListIndex) & "',#" & Date & "#)"
        cnn.Execute cnnstr
       
End Sub

Private Sub Form_Load()
    Me.Move (frmMain.ScaleWidth - Me.Width) / 2, (frmMain.ScaleHeight - Me.Height) / 2
    Dim strcnn As String
    strcnn = "Provider=Microsoft.Jet.OLEDB.3.51;Persist Security Info=False;Data Source=" & App.Path & "\BookManage.mdb"
    cnn.Open (strcnn)
End Sub


Private Sub Form_Unload(Cancel As Integer)
    cnn.Close
End Sub


Private Sub txtBNo_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then
 If txtBNo.Text = "" Then Exit Sub
    Dim rststr As String
    rststr = "select * from Book where [No]='" & txtBNo.Text & "'"
    rst.Open rststr, cnn, adOpenKeyset, adLockOptimistic, adCmdText
    If rst.RecordCount < 1 Then
        MsgBox "未找到记录,请重新输入。", , "信息"
        txtBNo.SetFocus
        rst.Close
        Exit Sub
     End If
    txtBName.Text = rst!Name
    Txtauthor.Text = rst!author
    Txtpublisher.Text = rst!publisher
    rst.Close
End If
End Sub

Private Sub txtPNo_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then txtPNo_LostFocus: txtBNo.SetFocus
End Sub

Private Sub txtPNo_LostFocus()
    If txtPNo.Text = "" Then Exit Sub
    Dim rststr As String
    rststr = "select * from Person where [No]='" & txtPNo.Text & "'"
    rst.Open rststr, cnn, adOpenKeyset, adLockOptimistic, adCmdText
    If rst.RecordCount < 1 Then
        MsgBox "未找到记录,请重新输入。", , "信息"
        txtPNo.SetFocus
        rst.Close
        Exit Sub
    End If
    txtPName.Text = rst!Name
    txtDepartment.Text = rst!Department
    rst.Close
End Sub

⌨️ 快捷键说明

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