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

📄 formoption.frm

📁 源程序职业中专图书管理系统
💻 FRM
📖 第 1 页 / 共 2 页
字号:
      Begin VB.Label Label3 
         Caption         =   "1"
         Height          =   225
         Index           =   1
         Left            =   510
         TabIndex        =   23
         Top             =   1275
         Width           =   195
      End
      Begin VB.Label Label4 
         Caption         =   "2"
         Height          =   195
         Index           =   1
         Left            =   510
         TabIndex        =   22
         Top             =   1650
         Width           =   240
      End
      Begin VB.Label Label5 
         Caption         =   "3"
         Height          =   180
         Index           =   1
         Left            =   510
         TabIndex        =   21
         Top             =   2025
         Width           =   105
      End
      Begin VB.Image Image3 
         Appearance      =   0  'Flat
         Height          =   480
         Left            =   -71295
         Picture         =   "Formoption.frx":08D8
         ToolTipText     =   "点击搜索"
         Top             =   495
         Width           =   480
      End
      Begin VB.Label Label2 
         AutoSize        =   -1  'True
         Caption         =   "借阅书号"
         Height          =   180
         Index           =   2
         Left            =   -73140
         TabIndex        =   16
         Top             =   1005
         Width           =   720
      End
      Begin VB.Label Label3 
         Caption         =   "1"
         Height          =   225
         Index           =   2
         Left            =   -74490
         TabIndex        =   15
         Top             =   1275
         Width           =   195
      End
      Begin VB.Label Label4 
         Caption         =   "2"
         Height          =   195
         Index           =   2
         Left            =   -74490
         TabIndex        =   14
         Top             =   1650
         Width           =   240
      End
      Begin VB.Label Label5 
         Caption         =   "3"
         Height          =   180
         Index           =   2
         Left            =   -74490
         TabIndex        =   13
         Top             =   2025
         Width           =   105
      End
      Begin VB.Label Label5 
         Caption         =   "3"
         Height          =   180
         Index           =   0
         Left            =   -74490
         TabIndex        =   6
         Top             =   2025
         Width           =   105
      End
      Begin VB.Label Label4 
         Caption         =   "2"
         Height          =   195
         Index           =   0
         Left            =   -74490
         TabIndex        =   5
         Top             =   1650
         Width           =   240
      End
      Begin VB.Label Label3 
         Caption         =   "1"
         Height          =   225
         Index           =   0
         Left            =   -74490
         TabIndex        =   4
         Top             =   1275
         Width           =   195
      End
      Begin VB.Label Label2 
         AutoSize        =   -1  'True
         Caption         =   "借阅书号"
         Height          =   180
         Index           =   0
         Left            =   -73140
         TabIndex        =   3
         Top             =   1005
         Width           =   720
      End
      Begin VB.Image Image1 
         Height          =   480
         Left            =   -71280
         Picture         =   "Formoption.frx":0D1A
         ToolTipText     =   "点击搜索"
         Top             =   500
         Width           =   480
      End
      Begin VB.Label Label1 
         Caption         =   "输入学号点击蓝色箭头"
         Height          =   420
         Index           =   0
         Left            =   -74820
         TabIndex        =   1
         Top             =   600
         Width           =   915
      End
   End
End
Attribute VB_Name = "Formoption"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False

'**************************************************

              '书籍借还操作窗体
'*********************************************
'所调用的API函数,自定义过程,类型,常数请参阅相应模块
Option Explicit
'Dim Adodc1.Recordset As Recordset  '窗体级变量,存放ADO控件的当前记录
Dim i As Integer

'***********窗体事件*******************

Private Sub Form_Load()
loadmdb Adodc1  '连接数据库
End Sub


'***************操作********************



'确定借书人借阅状况,已经设定为每人最多可借阅3本书籍
'借阅书籍时确定借书人情况并设置相应控件
Private Sub Image1_Click()
For i = 0 To 2
Text2(i).Enabled = False
Text2(i).Text = ""
Label8(i).Visible = False
Next i
Command1(0).Enabled = False
If Text1.Enabled = False Then
Text1.Enabled = True
Else
lockrecord Adodc1, "学生总表", "学号", Text1.Text
Set Adodc1.Recordset = Adodc1.Recordset
If Adodc1.Recordset.RecordCount = 0 Then
    MsgBox "学号输入有误。"
    Exit Sub
Else
    lockrecord Adodc1, "借阅总表", "学号", Text1.Text '从借阅表中读取学生借阅信息
    Set Adodc1.Recordset = Adodc1.Recordset
    If Adodc1.Recordset.RecordCount = 0 Then
        Text1.Enabled = False
        For i = 0 To 2
        Text2(i).Enabled = True
        Next i
        Command1(0).Enabled = True
    Else
        If Adodc1.Recordset.RecordCount > 3 Then
        MsgBox "数据记录出现错误,请查正。"
        Exit Sub
        End If
        '确定可借阅书籍数目并设置窗体中可用控件
        Adodc1.Recordset.MoveFirst
        i = 0
        Do While Not Adodc1.Recordset.EOF
        Text2(i).Text = Adodc1.Recordset!书号
        Text2(i).Enabled = False
        Label8(i).Visible = True
        Adodc1.Recordset.MoveNext
        i = i + 1
        Loop
        For i = 0 To 2
        If Text2(i).Text = "" Then
        Text2(i).Enabled = True
        Label8(i).Visible = False
        End If
        Next i
        Command1(0).Enabled = True
        Text1.Enabled = False
    End If
End If
End If
End Sub

'归还书籍时确定借书人情况并设置相应控件

Private Sub Image2_Click()
For i = 0 To 2
Text4(i).Enabled = False
Text4(i).Text = ""
Check1(i).Enabled = False
Check1(i).Value = False
Next i
Command1(2).Enabled = False
If Text3.Enabled = False Then
Text3.Enabled = True

Else


lockrecord Adodc1, "学生总表", "学号", Text3.Text
Set Adodc1.Recordset = Adodc1.Recordset
If Adodc1.Recordset.RecordCount = 0 Then
    MsgBox "学号输入有误。"
    Exit Sub
Else
    lockrecord Adodc1, "借阅总表", "学号", Text3.Text
    Set Adodc1.Recordset = Adodc1.Recordset
    If Adodc1.Recordset.RecordCount = 0 Then
        Text3.Enabled = False
        Exit Sub
    Else
        Adodc1.Recordset.MoveFirst
        i = 0
        Do While Not Adodc1.Recordset.EOF
        Text4(i).Text = Adodc1.Recordset!书号
        
        Check1(i).Enabled = True
        Adodc1.Recordset.MoveNext
        i = i + 1
        Loop
        Text3.Enabled = False
        Command1(1).Enabled = True
    End If
End If
End If
End Sub

'续借书籍时确定借书人情况并设置相应控件

Private Sub Image3_Click()
For i = 0 To 2
Text6(i).Enabled = False
Text6(i).Text = ""
Check2(i).Enabled = False
Check2(i).Value = False
Next i
Command1(2).Enabled = False
If Text5.Enabled = False Then
Text5.Enabled = True
Else
lockrecord Adodc1, "学生总表", "学号", Text5.Text
Set Adodc1.Recordset = Adodc1.Recordset
If Adodc1.Recordset.RecordCount = 0 Then
    MsgBox "学号输入有误。"
    Exit Sub
Else
    lockrecord Adodc1, "借阅总表", "学号", Text5.Text
    Set Adodc1.Recordset = Adodc1.Recordset
    If Adodc1.Recordset.RecordCount = 0 Then
        Text5.Enabled = False
       
        Exit Sub
    Else
        Adodc1.Recordset.MoveFirst
        i = 0
        Do While Not Adodc1.Recordset.EOF
        Text6(i).Text = Adodc1.Recordset!书号
        
        Check2(i).Enabled = True
        Adodc1.Recordset.MoveNext
        i = i + 1
        Loop
        Text5.Enabled = False
        Command1(2).Enabled = True
    End If
End If
End If
End Sub





'执行操作
Private Sub Command1_Click(Index As Integer)
Dim j As Integer
j = 0
Select Case Index
Case 0     '借阅书籍确定按钮
'判断要借书籍是否借出,书号是否正确,符合条件后执行操作
For i = 0 To 2
If Text2(i).Enabled = True And Text2(i).Text <> "" Then
    lockrecord Adodc1, "书籍总表", "书号", Text2(i).Text  '读取要借书籍的信息
    Set Adodc1.Recordset = Adodc1.Recordset
    If Adodc1.Recordset.RecordCount = 0 Then
        MsgBox "书号" & Text2(i).Text & "输入有误,请查正。操作中断,借阅书籍" & Str(j)
        Exit Sub
    Else
        If Adodc1.Recordset!是否借出 = "是" Then
        MsgBox "书籍" & Text2(i).Text & "已经借出。操作中断,借阅书籍" & Str(j)
        Exit Sub
        Else
       '符合后更新书籍记录并添加借阅记录
        Adodc1.Recordset!是否借出 = "是" '更新书籍记录
        Adodc1.Recordset.update
        Adodc1.Refresh
        Adodc1.CommandType = adCmdTable
        Adodc1.RecordSource = "借阅总表"
        Adodc1.Refresh
        Set Adodc1.Recordset = Adodc1.Recordset
        Adodc1.Recordset.AddNew   '添加新的借阅记录
        Adodc1.Recordset!学号 = Text1.Text
        Adodc1.Recordset!书号 = Text2(i).Text
        Adodc1.Recordset.update
        Adodc1.Refresh
        j = j + 1
        End If
    End If
End If
Next i
MsgBox "所有操作完成,借阅书籍" & Str(j)
Command1(0).Enabled = False
Text1.Enabled = True
'窗体数据显示同步更新
Image1_Click
If Text3.Text = Text1.Text Then
Text3.Enabled = True
Image2_Click
End If
If Text5.Text = Text1.Text Then
Text5.Enabled = True
Image3_Click
End If



Case 1   '归还书籍确定按钮

For i = 0 To 2
If Check1(i).Value = 1 Then
lockrecord Adodc1, "书籍总表", "书号", Text4(i).Text
Set Adodc1.Recordset = Adodc1.Recordset
Adodc1.Recordset!是否借出 = "否"   '更新书籍记录
Adodc1.Recordset.update
Adodc1.Refresh
lockrecord Adodc1, "借阅总表", "书号", Text4(i).Text
Adodc1.Recordset.Delete     '删除相应的借阅记录
Adodc1.Refresh
j = j + 1
End If
Next i
MsgBox "操作完成,归还书籍" & Str(j)
Command1(1).Enabled = False
Text3.Enabled = True
'窗体数据显示同步更新
Image2_Click
If Text1.Text = Text3.Text Then
Text1.Enabled = True
Image1_Click
End If
If Text5.Text = Text3.Text Then
Text5.Enabled = True
Image3_Click
End If


Case 2
For i = 0 To 2
If Check2(i).Value = 1 Then
lockrecord Adodc1, "借阅总表", "书号", Text4(i).Text
Set Adodc1.Recordset = Adodc1.Recordset
Adodc1.Recordset!截止日期 = Adodc1.Recordset!截止日期 + 30   '更新借阅记录中截止日期字段
Adodc1.Recordset.update
Adodc1.Refresh
j = j + 1
End If
Next i
MsgBox "操作完成,续借书籍" & Str(j)
Command1(2).Enabled = False
Text5.Enabled = True
'窗体数据显示同步更新
Image3_Click
If Text1.Text = Text5.Text Then
Text1.Enabled = True
Image1_Click
End If
If Text3.Text = Text5.Text Then
Text3.Enabled = True
Image2_Click
End If


End Select
End Sub






'******************其他****************************
Private Sub Command2_Click(Index As Integer)
Unload Me
End Sub







Private Sub Image2_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
Image2.BorderStyle = 1
End Sub

Private Sub Image2_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
Image2.BorderStyle = 0
End Sub
Private Sub Image3_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
Image3.BorderStyle = 1
End Sub

Private Sub Image3_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
Image3.BorderStyle = 0
End Sub
Private Sub Image1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
Image1.BorderStyle = 1
End Sub

Private Sub Image1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
Image1.BorderStyle = 0
End Sub



⌨️ 快捷键说明

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