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

📄 frmreturn.frm

📁 VB通讯软件 VB通讯软件 VB通讯软件
💻 FRM
字号:
VERSION 5.00
Begin VB.Form frmReturn 
   BorderStyle     =   3  'Fixed Dialog
   Caption         =   "还书"
   ClientHeight    =   4200
   ClientLeft      =   45
   ClientTop       =   330
   ClientWidth     =   7380
   Icon            =   "frmReturn.frx":0000
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MDIChild        =   -1  'True
   MinButton       =   0   'False
   Picture         =   "frmReturn.frx":0442
   ScaleHeight     =   4200
   ScaleWidth      =   7380
   ShowInTaskbar   =   0   'False
   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        =   13
      Top             =   3540
      Width           =   1215
   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        =   6
      Top             =   60
      Width           =   6735
      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.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        =   8
         Top             =   240
         Width           =   1815
      End
      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        =   7
         Top             =   240
         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        =   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        =   11
         Top             =   360
         Width           =   1215
      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        =   10
         Top             =   360
         Width           =   1215
      End
   End
   Begin VB.Frame Frame2 
      Caption         =   "还书"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   11.25
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   2295
      Left            =   120
      TabIndex        =   2
      Top             =   960
      Width           =   7095
      Begin VB.TextBox txtDate 
         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            =   1320
         TabIndex        =   17
         Top             =   1680
         Width           =   1575
      End
      Begin VB.TextBox txtBName 
         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            =   840
         TabIndex        =   15
         Top             =   1260
         Width           =   2055
      End
      Begin VB.ListBox lstBorrow 
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   11.25
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   960
         ItemData        =   "frmReturn.frx":0884
         Left            =   360
         List            =   "frmReturn.frx":0886
         TabIndex        =   14
         Top             =   240
         Width           =   2535
      End
      Begin VB.ListBox lstBook 
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   11.25
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   1860
         ItemData        =   "frmReturn.frx":0888
         Left            =   3240
         List            =   "frmReturn.frx":088A
         TabIndex        =   5
         Top             =   240
         Width           =   2295
      End
      Begin VB.CommandButton cmdAdd 
         Caption         =   "添加(&A)"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   11.25
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   495
         Left            =   5640
         TabIndex        =   4
         Top             =   600
         Width           =   1215
      End
      Begin VB.CommandButton cmdDelete 
         Caption         =   "删除(&D)"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   11.25
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   495
         Left            =   5640
         TabIndex        =   3
         Top             =   1200
         Width           =   1215
      End
      Begin VB.Label Label1 
         Caption         =   "借阅时间:"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   11.25
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   375
         Left            =   240
         TabIndex        =   18
         Top             =   1740
         Width           =   1215
      End
      Begin VB.Label Label6 
         Caption         =   "书名:"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   11.25
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   375
         Left            =   240
         TabIndex        =   16
         Top             =   1320
         Width           =   1215
      End
   End
   Begin VB.CommandButton cmdOK 
      Caption         =   "确认(&O)"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   11.25
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   495
      Left            =   3360
      TabIndex        =   1
      Top             =   3540
      Width           =   1215
   End
   Begin VB.CommandButton cmdCancel 
      Caption         =   "取消(&C)"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   11.25
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   495
      Left            =   4680
      TabIndex        =   0
      Top             =   3540
      Width           =   1215
   End
End
Attribute VB_Name = "frmReturn"
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 = lstBorrow.List(lstBorrow.ListIndex)
    
    For i = 0 To lstBook.ListCount - 1
        If lstBook.List(i) = BookNo Then
            MsgBox "该书已经被归还", , "信息"
            lstBorrow.SetFocus
            Exit Sub
        End If
    Next
    lstBook.AddItem BookNo
    lstBorrow.SetFocus
End Sub

Private Sub cmdDelete_Click()
    If lstBook.ListCount > 0 Then
      lstBook.ListIndex = 0
    Else
      Exit Sub
    End If
    lstBook.RemoveItem lstBook.ListIndex
    txtPNo.SetFocus
End Sub

Private Sub cmdExit_Click()
    Unload Me
End Sub

Private Sub cmdOK_Click()
    Dim pstr As String, cnnstr As String
    pstr = "update borrow set [to] = #" & Date & "# where [PNo] = '" & txtPNo.Text & "' and [BNo]='"
    For i = 0 To lstBook.ListCount - 1
        cnnstr = pstr & lstBook.List(i) & "'"
        cnn.Execute cnnstr
    Next
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 lstBorrow_Click()
    Dim rststr As String, BNo As String
    BNo = lstBorrow.List(lstBorrow.ListIndex)
    '从Book表中查找记录
    rststr = "select [Name] from Book where [No]='" & BNo & "'"
    rst.Open rststr, cnn, adOpenKeyset, adLockOptimistic, adCmdText
    txtBName.Text = rst![Name]
    '从Borrow表中查找记录
    rst.Close
    rststr = "select [From] from Borrow where [PNo]='" & txtPNo.Text & "' and [BNo]='" & BNo & "'"
    rst.Open rststr, cnn, adOpenKeyset, adLockOptimistic, adCmdText
    txtDate.Text = rst![From]
    rst.Close
End Sub

Private Sub txtPNo_LostFocus()
    If txtPNo.Text = "" Then Exit Sub
    Dim rststr As String
    '从Person表中查找记录
    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
    '从Borrow表中查找记录
    rststr = "select * from Borrow where [PNo]='" & txtPNo.Text & "' and [to]=Null"
    rst.Open rststr, cnn, adOpenKeyset, adLockOptimistic, adCmdText
    If rst.RecordCount < 1 Then
        MsgBox "没有借阅图书,请重新输入。", , "信息"
        txtPNo.SetFocus
        rst.Close
        Exit Sub
    End If
    Dim i As Integer
    lstBorrow.Clear
    For i = 1 To rst.RecordCount
        lstBorrow.AddItem rst!BNo
        rst.MoveNext
    Next
    rst.Close
    lstBorrow.ListIndex = 0
    lstBorrow_Click
End Sub

⌨️ 快捷键说明

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