📄 searchbook.frm
字号:
End
Begin VB.Label Label1
AutoSize = -1 'True
BackColor = &H80000000&
Caption = "出版社:"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00800000&
Height = 240
Index = 4
Left = 3600
TabIndex = 10
Top = 2880
Width = 915
End
Begin VB.Label Label1
AutoSize = -1 'True
BackColor = &H80000000&
Caption = "书号 书名 作者"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00800000&
Height = 240
Index = 2
Left = 240
TabIndex = 9
Top = 480
Width = 2625
End
End
Begin VB.CommandButton Command2
Caption = "清 除"
Height = 495
Left = 5520
TabIndex = 6
Top = 720
Width = 735
End
Begin VB.CommandButton Command1
BackColor = &H00FF8080&
Caption = "查 询"
Default = -1 'True
Height = 495
Left = 4200
TabIndex = 5
Top = 720
Width = 855
End
Begin VB.TextBox keyword
BackColor = &H80000016&
ForeColor = &H00400040&
Height = 270
Left = 2520
TabIndex = 4
Top = 840
Width = 1455
End
Begin VB.ComboBox way
BackColor = &H80000016&
ForeColor = &H00400040&
Height = 300
ItemData = "searchbook.frx":0000
Left = 600
List = "searchbook.frx":0002
Style = 2 'Dropdown List
TabIndex = 1
Top = 840
Width = 1335
End
Begin VB.Label Label1
AutoSize = -1 'True
BackColor = &H80000000&
Caption = "查询关键字"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00800000&
Height = 240
Index = 1
Left = 2520
TabIndex = 3
Top = 360
Width = 1290
End
Begin VB.Label Label1
AutoSize = -1 'True
BackColor = &H80000000&
Caption = "查询方式"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00800000&
Height = 240
Index = 0
Left = 720
TabIndex = 2
Top = 360
Width = 1035
End
End
Begin VB.Label Label2
AutoSize = -1 'True
BackColor = &H80000000&
Caption = "图书查询向导"
BeginProperty Font
Name = "宋体"
Size = 15.75
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00FF0000&
Height = 315
Left = 2400
TabIndex = 16
Top = 120
Width = 1995
End
End
Attribute VB_Name = "searchbook"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim condition As String
Private Sub Command1_Click()
Dim rs As Recordset
Set rs = bookdata.Recordset
rs.MoveFirst
If Trim(way.Text) <> "" Then
If way.Text = "书号" Then
condition = "书号='" & keyword.Text & "'"
rs.FindFirst condition
If rs.NoMatch Then
MsgBox "没有该书号,请重试!"
Else
Call asd
End If
End If
If way.Text = "书名" Then
condition = "书名='" & keyword.Text & "'"
rs.FindFirst condition
If rs.NoMatch Then
MsgBox "没有该书名,请重试!"
Else
Call asd
End If
End If
If way.Text = "书籍类别" Then
condition = "书籍类别='" & keyword.Text & "'"
rs.FindFirst condition
If rs.NoMatch Then
MsgBox "没有该类书籍,请重试!"
Else
Call asd
End If
End If
If way.Text = "作者" Then
condition = "作者='" & keyword.Text & "'"
rs.FindFirst condition
If rs.NoMatch Then
MsgBox "没有该作者,请重试!"
Else
Call asd
End If
End If
MsgBox "恭喜你!查询成功"
Else
MsgBox "你还没有选择,查询方式,请选择!"
End If
End Sub
Private Sub Command2_Click()
booklist.Clear
keyword.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Text6.Text = ""
Text7.Text = ""
Text5.Text = ""
End Sub
Private Sub Command3_Click()
Unload searchbook
End Sub
Private Sub Form_Load()
way.AddItem "书号"
way.AddItem "书名"
way.AddItem "书籍类别"
way.AddItem "作者"
End Sub
Private Sub keyword_LostFocus()
Command1.SetFocus
End Sub
Private Sub way_Change()
keyword.Text = ""
End Sub
Private Sub asd()
Dim rs As Recordset
Set rs = bookdata.Recordset
booklist.AddItem rs.Fields("书号") & " " & rs.Fields("书名") & " " & rs.Fields("作者")
Text7.Text = rs.Fields("书籍类别")
Text2.Text = rs.Fields("出版社")
Text3.Text = rs.Fields("总数")
Text4.Text = rs.Fields("在库数目")
Text5.Text = rs.Fields("单价")
Text6.Text = rs.Fields("购买日期")
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -