📄 frmquerybook.frm
字号:
VERSION 5.00
Object = "{00028C01-0000-0000-0000-000000000046}#1.0#0"; "DBGRID32.OCX"
Object = "{BDC217C8-ED16-11CD-956C-0000C04E4C0A}#1.1#0"; "TABCTL32.OCX"
Begin VB.Form frmQueryBook
Caption = "借还书情况查询"
ClientHeight = 9090
ClientLeft = 60
ClientTop = 1560
ClientWidth = 15240
Icon = "frmQueryBook.frx":0000
LinkTopic = "Form1"
LockControls = -1 'True
MDIChild = -1 'True
ScaleHeight = 9090
ScaleWidth = 15240
WindowState = 2 'Maximized
Begin TabDlg.SSTab SSTab1
Height = 8895
Left = 120
TabIndex = 0
Top = 120
Width = 15015
_ExtentX = 26485
_ExtentY = 15690
_Version = 393216
Tabs = 1
TabHeight = 520
ForeColor = 33023
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "华文行楷"
Size = 14.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
TabCaption(0) = "借还书情况查询"
TabPicture(0) = "frmQueryBook.frx":0442
Tab(0).ControlEnabled= -1 'True
Tab(0).Control(0)= "Label2"
Tab(0).Control(0).Enabled= 0 'False
Tab(0).Control(1)= "Label1"
Tab(0).Control(1).Enabled= 0 'False
Tab(0).Control(2)= "DBGrid1"
Tab(0).Control(2).Enabled= 0 'False
Tab(0).Control(3)= "Frame1"
Tab(0).Control(3).Enabled= 0 'False
Tab(0).Control(4)= "Data1"
Tab(0).Control(4).Enabled= 0 'False
Tab(0).Control(5)= "cmdClose"
Tab(0).Control(5).Enabled= 0 'False
Tab(0).Control(6)= "cmdQuery"
Tab(0).Control(6).Enabled= 0 'False
Tab(0).Control(7)= "comSort"
Tab(0).Control(7).Enabled= 0 'False
Tab(0).Control(8)= "txtContent"
Tab(0).Control(8).Enabled= 0 'False
Tab(0).Control(9)= "DBGrid2"
Tab(0).Control(9).Enabled= 0 'False
Tab(0).Control(10)= "Data2"
Tab(0).Control(10).Enabled= 0 'False
Tab(0).Control(11)= "chkLost"
Tab(0).Control(11).Enabled= 0 'False
Tab(0).Control(12)= "Frame2"
Tab(0).Control(12).Enabled= 0 'False
Tab(0).ControlCount= 13
Begin VB.Frame Frame2
Caption = "借还书选择"
Height = 765
Left = 5760
TabIndex = 13
Top = 360
Width = 1215
Begin VB.CheckBox chkReturn
Caption = "还书"
Height = 180
Left = 240
TabIndex = 15
Top = 480
Width = 735
End
Begin VB.CheckBox chkBorrow
Caption = "借书"
Height = 180
Left = 240
TabIndex = 14
Top = 240
Width = 735
End
End
Begin VB.CheckBox chkLost
Caption = "所还书是否遗失"
Enabled = 0 'False
Height = 255
Left = 8880
TabIndex = 12
Top = 600
Width = 1575
End
Begin VB.Data Data2
Connect = "Access 2000;"
DatabaseName = ""
DefaultCursorType= 0 '缺省游标
DefaultType = 2 '使用 ODBC
Exclusive = 0 'False
Height = 375
Left = 240
Options = 0
ReadOnly = 0 'False
RecordsetType = 1 'Dynaset
RecordSource = ""
Top = 8400
Width = 14535
End
Begin MSDBGrid.DBGrid DBGrid2
Bindings = "frmQueryBook.frx":045E
Height = 3495
Left = 240
OleObjectBlob = "frmQueryBook.frx":0472
TabIndex = 11
Top = 4800
Width = 14535
End
Begin VB.TextBox txtContent
Height = 270
Left = 1080
TabIndex = 8
Top = 600
Width = 1455
End
Begin VB.ComboBox comSort
Height = 300
Left = 3600
Style = 2 'Dropdown List
TabIndex = 7
Top = 585
Width = 1815
End
Begin VB.CommandButton cmdQuery
Caption = "查询(&Q)"
Default = -1 'True
Height = 375
Left = 10680
TabIndex = 6
Top = 555
Width = 975
End
Begin VB.CommandButton cmdClose
Cancel = -1 'True
Caption = "关闭(&C)"
Height = 375
Left = 12240
TabIndex = 5
Top = 555
Width = 975
End
Begin VB.Data Data1
Connect = "Access 2000;"
DatabaseName = ""
DefaultCursorType= 0 '缺省游标
DefaultType = 2 '使用 ODBC
Exclusive = 0 'False
Height = 375
Left = 240
Options = 0
ReadOnly = 0 'False
RecordsetType = 1 'Dynaset
RecordSource = ""
Top = 4320
Width = 14535
End
Begin VB.Frame Frame1
Caption = "排序"
Height = 765
Left = 7320
TabIndex = 1
Top = 360
Width = 1215
Begin VB.OptionButton optAscending
Caption = "升序"
Height = 180
Left = 240
TabIndex = 3
Top = 240
Value = -1 'True
Width = 735
End
Begin VB.OptionButton optDescending
Caption = "降序"
Height = 180
Left = 240
TabIndex = 2
Top = 480
Width = 735
End
End
Begin MSDBGrid.DBGrid DBGrid1
Bindings = "frmQueryBook.frx":0E35
Height = 3015
Left = 240
OleObjectBlob = "frmQueryBook.frx":0E49
TabIndex = 4
Top = 1245
Width = 14535
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "查询内容:"
Height = 180
Left = 240
TabIndex = 10
Top = 645
Width = 810
End
Begin VB.Label Label2
AutoSize = -1 'True
Caption = "选择类型:"
Height = 180
Left = 2760
TabIndex = 9
Top = 645
Width = 810
End
End
End
Attribute VB_Name = "frmQueryBook"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim db As Database, rs As Recordset
Dim strAppName, strSQL As String, strCardShort() As String
Private Sub cmdClose_Click()
Unload Me
End Sub
Private Sub cmdQuery_Click()
On Error GoTo QueryErr
If Trim(txtContent) = "" Then '检查有效性
MsgBox "查询内容不能为空!", vbExclamation + vbOKOnly
txtContent.SetFocus
Exit Sub
End If
Dim blnOrdering As Boolean
If optAscending.Value = True Then blnOrdering = True '升序
If optDescending.Value = True Then blnOrdering = False '降序
If comSort.Text = "借书证号" Then
Dim strCardNo As String
strCardNo = Trim(txtContent)
If chkBorrow Then
strAppName = App.Path & "\读者借书库.mdb"
strSQL = "select 所借图书编号,借书日期,还书日期,应还书日期 from 读者借书表 where 借书证号='" & strCardNo & "' and 还书标志=false"
strSQL = strSQL & " order by 所借图书编号"
If blnOrdering = False Then strSQL = strSQL & " desc"
Data1.DatabaseName = strAppName
Data1.RecordSource = strSQL
DBGrid1.Caption = "借书情况表"
Data1.Refresh
End If
If chkReturn Then
strAppName = App.Path & "\费用库.mdb"
strSQL = "select 图书编号,借书日期,应还日期,还书日期,借书费用,超期费用,遗失费用,附加费用,总费用,押金 from 费用表 where 借书证号='" & strCardNo & "'"
strSQL = strSQL & " order by 图书编号"
If blnOrdering = False Then strSQL = strSQL & " desc"
Data2.DatabaseName = strAppName
Data2.RecordSource = strSQL
DBGrid2.Caption = "还书情况表"
Data2.Refresh
End If
ElseIf comSort.Text = "图书编号" Then
Dim strBookNo As String
strBookNo = Trim(txtContent)
If chkBorrow Then
strAppName = App.Path & "\读者借书库.mdb"
strSQL = "select 借书证号,借书日期,还书日期,应还书日期 from 读者借书表 where 所借图书编号='" & strBookNo & "' and 还书标志=false"
strSQL = strSQL & " order by 借书证号"
If blnOrdering = False Then strSQL = strSQL & " desc"
Data1.DatabaseName = strAppName
Data1.RecordSource = strSQL
DBGrid1.Caption = "借书情况表"
Data1.Refresh
End If
If chkReturn Then
strAppName = App.Path & "\费用库.mdb"
strSQL = "select 借书证号,借书日期,应还日期,还书日期,借书费用,超期费用,遗失费用,附加费用,总费用,押金 from 费用表 where 图书编号='" & strBookNo & "'"
strSQL = strSQL & " order by 借书证号"
If blnOrdering = False Then strSQL = strSQL & " desc"
Data2.DatabaseName = strAppName
Data2.RecordSource = strSQL
DBGrid2.Caption = "还书情况表"
Data2.Refresh
End If
End If
Exit Sub
QueryErr:
MsgBox Err.Description
End Sub
Private Sub comSort_Click()
txtContent.SetFocus
SendKeys "{Home}+{End}"
End Sub
Private Sub Data1_Reposition()
Data1.Caption = "图书记录:" & Data1.Recordset.AbsolutePosition + 1
End Sub
Private Sub Data2_Reposition()
Data2.Caption = "图书记录:" & Data2.Recordset.AbsolutePosition + 1
With Data2.Recordset
If .RecordCount = 0 Then Exit Sub
If .Fields("遗失费用") > 0 Then
chkLost.Value = 1 'Checked
Else
chkLost.Value = 0 'Unchecked
End If
End With
End Sub
Private Sub Form_Activate()
txtContent.SetFocus
End Sub
Private Sub Form_Load()
OFFCAT.Play "wave"
comSort.AddItem "借书证号"
comSort.AddItem "图书编号"
chkLost.DataField = "遗失标志"
End Sub
Private Sub Form_Resize()
SSTab1.Left = (Me.Width - SSTab1.Width) / 2
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -