📄 删除旧书.frm
字号:
VERSION 5.00
Begin VB.Form form6
Caption = "Form2"
ClientHeight = 4545
ClientLeft = 60
ClientTop = 390
ClientWidth = 5880
LinkTopic = "Form2"
ScaleHeight = 4545
ScaleWidth = 5880
StartUpPosition = 3 '窗口缺省
Begin VB.TextBox Text2
Height = 495
Left = 1800
TabIndex = 6
Top = 1800
Width = 2295
End
Begin VB.CommandButton Command2
Caption = "取消"
Height = 495
Left = 3360
TabIndex = 3
Top = 3480
Width = 1095
End
Begin VB.CommandButton Command1
Caption = "确定"
Height = 495
Left = 1560
TabIndex = 2
Top = 3480
Width = 1095
End
Begin VB.TextBox Text1
Height = 615
Left = 1680
TabIndex = 1
Top = 840
Width = 2895
End
Begin VB.Label Label3
Caption = "数量"
Height = 495
Left = 480
TabIndex = 5
Top = 1920
Width = 1095
End
Begin VB.Label Label2
Caption = "删除书库的某些图书"
BeginProperty Font
Name = "宋体"
Size = 14.25
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H000000C0&
Height = 495
Left = 360
TabIndex = 4
Top = 120
Width = 4455
End
Begin VB.Label Label1
Caption = "输入书号"
Height = 615
Left = 480
TabIndex = 0
Top = 840
Width = 1575
End
End
Attribute VB_Name = "form6"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim note As New ADODB.Recordset
Private Sub Command1_Click()
Dim sql As String
Dim answer As Integer
sql = "select * from 书库表 where 书号='" & Trim(Text1.Text) & "'"
note.Open sql, cnn, 3, 2
If note.BOF And note.EOF Then
MsgBox ("无此记录!")
note.Close
Text1.Text = ""
Else
answer = MsgBox("你确定要删除此类图书吗?", vbYesNo, "提示")
If answer = vbYes Then
If note.Fields("数量").Value = 0 Then
note.Delete
note.Close
Text1.Text = ""
ElseIf note.Fields("数量").Value = Val(Text2.Text) Then
note.Delete
note.Close
Text1.Text = ""
MsgBox "此图书已全部删除!"
ElseIf note.Fields("数量").Value > Val(Text2.Text) Then
note.Fields("数量").Value = note.Fields("数量").Value - Val(Text2.Text)
note.Update
note.Close
Text1.Text = ""
MsgBox "此图书已删掉" + Text2.Text
Else
MsgBox "此类图书没有这么多,请重新输入数量!"
note.Close
Text1.Text = ""
Text2.Text = ""
End If
End If
End If
End Sub
Private Sub Command2_Click()
Unload Me
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -