📄 form6.frm
字号:
VERSION 5.00
Begin VB.Form HuanShuXiuGai
Caption = "还书信息修改"
ClientHeight = 7755
ClientLeft = 2595
ClientTop = 2475
ClientWidth = 9570
LinkTopic = "Form6"
ScaleHeight = 7755
ScaleWidth = 9570
Begin VB.CommandButton Command3
Caption = "取消"
Height = 375
Left = 7560
TabIndex = 12
Top = 5760
Width = 1095
End
Begin VB.Frame Frame2
Caption = "修改区"
BeginProperty Font
Name = "宋体"
Size = 14.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 4455
Left = 5040
TabIndex = 4
Top = 720
Width = 3855
Begin VB.TextBox Text5
Height = 495
Left = 1800
TabIndex = 8
Top = 2760
Width = 1455
End
Begin VB.TextBox Text4
Height = 495
Left = 1800
TabIndex = 7
Top = 1680
Width = 1455
End
Begin VB.TextBox Text3
Height = 495
Left = 1800
TabIndex = 6
Top = 720
Width = 1455
End
Begin VB.CommandButton Command2
Caption = "修改"
Height = 375
Left = 2040
TabIndex = 5
Top = 3600
Width = 1095
End
Begin VB.Label Label5
Caption = "还书日期"
BeginProperty Font
Name = "宋体"
Size = 14.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 360
TabIndex = 11
Top = 2760
Width = 1215
End
Begin VB.Label Label4
Caption = "借书证号"
BeginProperty Font
Name = "宋体"
Size = 14.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 360
TabIndex = 10
Top = 1680
Width = 1215
End
Begin VB.Label Label3
Caption = "书号"
BeginProperty Font
Name = "宋体"
Size = 14.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 360
TabIndex = 9
Top = 720
Width = 735
End
End
Begin VB.Frame Frame1
Caption = "请输入书号"
BeginProperty Font
Name = "宋体"
Size = 14.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 4455
Left = 960
TabIndex = 0
Top = 720
Width = 3735
Begin VB.CommandButton Command1
Caption = "查询"
Height = 375
Left = 1800
TabIndex = 2
Top = 3600
Width = 1095
End
Begin VB.TextBox Text1
Height = 495
Left = 1320
TabIndex = 1
Top = 1680
Width = 1695
End
Begin VB.Label Label1
Caption = "书号"
BeginProperty Font
Name = "宋体"
Size = 14.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 120
TabIndex = 3
Top = 1800
Width = 735
End
End
End
Attribute VB_Name = "HuanShuXiuGai"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim flag As Boolean
Public rs_find As adodb.Recordset
Private Sub Command1_Click()
flag = False
Set rs_find = New adodb.Recordset
rs_find.Open "select * from returninfo where bookno='" & Text1.Text & "'", conn, adOpenStatic, adLockOptimistic
If rs_find.Fields("bookno") = "" Then
MsgBox "无信息,请重新输入书号"
Call clear
Else
Text3.Text = rs_find.Fields("bookno")
Text4.Text = rs_find.Fields("returnno")
Text5.Text = rs_find.Fields("returndate")
End If
End Sub
Private Sub Command2_Click()
If flag = False Then
Dim bid As New adodb.Recordset
Dim nid As New adodb.Recordset
Dim lid As New adodb.Recordset
bid.Open "select * from books where bookid='" & Text3.Text & "'", conn, adOpenStatic, adLockOptimistic
nid.Open "select * from readers where readerno='" & Text4.Text & "'", conn, adOpenStatic, adLockOptimistic
If rs_find.EOF = False Then
Dim book As New adodb.Recordset
If Text3.Text <> rs_find.Fields("bookno") Then
If bid.EOF = False Then
rs_find.Fields("bookno") = Trim(Text3.Text)
Else
MsgBox "无此书"
Call clear
End If
End If
If Text4.Text <> rs_find.Fields("returnno") Then
If nid.EOF = False Then
rs_find.Fields("returnno") = Trim(Text4.Text)
Else
MsgBox "无此读者"
Call clear
End If
End If
If Text5.Text <> rs_find.Fields("returndate") Then
rs_find.Fields("returndate") = Trim(Text5.Text)
End If
Dim re As New adodb.Recordset
Dim re1 As New adodb.Recordset
re.Open "select * from returninfo where bookno ='" & rs_find.Fields("bookno") & "'", conn, adOpenStatic, adLockOptimistic
re1.Open "select * from returninfo where bookno='" & Text1.Text & "'", conn, adOpenStatic, adLockOptimistic
If re.EOF = False And re1.EOF = False Then
If re.EOF = False And (re.Fields("returnno") <> re1.Fields("returnno") Or re.Fields("returndate") <> re1.Fields("returndate")) Then
re.Delete (adAffectCurrent)
re.Update
End If
End If
If nid.EOF = False And bid.EOF = False Then
rs_find.Update
book.Open "select * from books where bookid ='" & rs_find.Fields("bookno") & "'", conn, adOpenStatic, adLockOptimistic
If book.EOF = False Then
book.Fields("putup") = Trim("未借")
book.Update
MsgBox "修改成功"
Call clear
Dim borrow As New adodb.Recordset
borrow.Open "select * from borrowinfo where bookno='" & Text3.Text & "' ", conn, adOpenStatic, adLockOptimistic
If borrow.EOF = False Then
borrow.Fields("borrowno") = Text3.Text
borrow.Delete (adAffectCurrent)
borrow.Update
End If
Else
MsgBox "请输入书号后查询"
Call clear
End If
End If
Else
MsgBox "请输入书号后查询"
Call clear
End If
Else
MsgBox "请输入书号后查询"
Call clear
End If
End Sub
Private Sub Command3_Click()
Unload Me
End Sub
Private Sub Form_Load()
flag = True
Set rs_find = New adodb.Recordset
rs_find.Open "select * from returninfo", conn, adOpenStatic, adLockOptimistic
End Sub
Private Sub clear()
Text1.Text = ""
Text3.Text = ""
Text4.Text = ""
Text5.Text = ""
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -