📄 addbook.frm
字号:
Width = 855
End
Begin VB.Label Label3
Height = 375
Left = 240
TabIndex = 7
Top = 1680
Width = 855
End
Begin VB.Label Label2
Caption = "借阅证号"
Height = 255
Left = 3720
TabIndex = 5
Top = 720
Width = 975
End
Begin VB.Label Label1
Caption = "学号"
Height = 375
Left = 480
TabIndex = 3
Top = 720
Width = 735
End
End
Begin VB.Frame Frame1
Caption = "借书信息"
BeginProperty Font
Name = "幼圆"
Size = 10.5
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 2895
Left = 120
TabIndex = 0
Top = 120
Width = 14415
Begin MSDataGridLib.DataGrid DataGrid1
Bindings = "addbook.frx":0000
Height = 2175
Left = 1680
TabIndex = 1
Top = 360
Width = 11055
_ExtentX = 19500
_ExtentY = 3836
_Version = 393216
AllowUpdate = 0 'False
HeadLines = 1
RowHeight = 15
BeginProperty HeadFont {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ColumnCount = 2
BeginProperty Column00
DataField = ""
Caption = ""
BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED}
Type = 0
Format = ""
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 2052
SubFormatType = 0
EndProperty
EndProperty
BeginProperty Column01
DataField = ""
Caption = ""
BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED}
Type = 0
Format = ""
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 2052
SubFormatType = 0
EndProperty
EndProperty
SplitCount = 1
BeginProperty Split0
BeginProperty Column00
EndProperty
BeginProperty Column01
EndProperty
EndProperty
End
End
Begin MSAdodcLib.Adodc Adodc2
Height = 615
Left = 11760
Top = 4200
Width = 2760
_ExtentX = 4868
_ExtentY = 1085
ConnectMode = 0
CursorLocation = 3
IsolationLevel = -1
ConnectionTimeout= 15
CommandTimeout = 30
CursorType = 3
LockType = 3
CommandType = 2
CursorOptions = 0
CacheSize = 50
MaxRecords = 0
BOFAction = 0
EOFAction = 0
ConnectStringType= 1
Appearance = 1
BackColor = -2147483643
ForeColor = -2147483640
Orientation = 0
Enabled = -1
Connect = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=图书馆管理系统.mdb;Persist Security Info=False"
OLEDBString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=图书馆管理系统.mdb;Persist Security Info=False"
OLEDBFile = ""
DataSourceName = ""
OtherAttributes = ""
UserName = ""
Password = ""
RecordSource = "罚款数据"
Caption = "Adodc2"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
_Version = 393216
End
End
Attribute VB_Name = "bbook"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
Dim huanriqi As Date
Dim yue As String
If Text1.Text <> "" And Text2.Text <> "" And Text3.Text <> "" Then
Adodc3.Recordset.Filter = "学号='" & Text1.Text & "'"
If Adodc3.Recordset.EOF = False Then
Adodc1.Recordset.Filter = "学号='" & Text1.Text & "'"
If Adodc1.Recordset.EOF = True Then
Adodc1.Recordset.AddNew
Adodc1.Recordset.Fields("学号") = Text1.Text
Adodc1.Recordset.Fields("借阅证号") = Text2.Text
Adodc1.Recordset.Fields("图书编号") = Text3.Text
Adodc1.Recordset.Fields("借书日期") = Date
huanriqi = Date + 30
Adodc1.Recordset.Fields("还书日期") = huanriqi
Adodc1.Recordset.Update
Else
MsgBox "该生已经借了一本书!"
Exit Sub
End If
Else
MsgBox "没有该生信息"
End If
Else
MsgBox "借阅信息不能为空!"
End If
Adodc1.Recordset.Filter = ""
Set DataGrid1.DataSource = Adodc1.Recordset
End Sub
Private Sub Command2_Click()
Dim tianshu As Integer, jine As Integer
Dim huanriqi As Date
dang = Date
huanriqi = Adodc1.Recordset.Fields("还书日期")
If dang < huanriqi Then
Adodc1.Recordset.Delete
Adodc1.Recordset.MoveNext
Else
tianshu = dang - huanriqi
If tianshu < 15 Then
jine = 0.1 * tianshu
Else
Adodc2.Recordset.AddNew
Adodc2.Recordset.Fields("学号") = Text1.Text
Adodc2.Recordset.Fields("超过天数") = tianshu
Adodc2.Recordset.Fields("罚款金额") = jine
Adodc2.Recordset.Update
MsgBox "超过天数,请先交罚款"
fakuan.Show
Adodc1.Recordset.Delete
Adodc1.Recordset.MoveNext
End If
End If
Command2.Enabled = False
command3.Enabled = False
End Sub
Private Sub command3_Click()
Dim huanriqi As Date
huanriqi = Adodc1.Recordset.Fields("还书日期")
Combo4.Text = Val(Mid(huanriqi, 1, 4))
Combo5.Text = Val(Mid(huanriqi, 6, 2))
Text5.Text = Val(Right(huanriqi, 2))
If Combo5.Text = 12 Then
Combo4.Text = Combo4.Text + 1
Combo5.Text = 1
Else
Combo5.Text = Combo5.Text + 1
huanriqi = Combo4.Text & "-" & Combo5.Text & "-" & Text5.Text
Adodc1.Recordset.Fields("还书日期") = huanriqi
Adodc1.Recordset.Update
End If
command3.Enabled = False
End Sub
Private Sub Command4_Click()
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
End Sub
Private Sub DataGrid1_SelChange(Cancel As Integer)
Command2.Enabled = True
command3.Enabled = True
Dim riqi As Date, huanriqi As Date
Text1.Text = Adodc1.Recordset.Fields("学号")
Text2.Text = Adodc1.Recordset.Fields("借阅证号")
Text3.Text = Adodc1.Recordset.Fields("图书编号")
riqi = Adodc1.Recordset.Fields("借书日期")
Combo1.Text = Val(Mid(riqi, 1, 4))
Combo2.Text = Val(Mid(riqi, 6, 2))
Text4.Text = Val(Right(riqi, 2))
huanriqi = Adodc1.Recordset.Fields("还书日期")
Combo4.Text = Year(huanriqi)
Combo5.Text = Month(huanriqi)
Text5.Text = Day(huanriqi)
End Sub
Private Sub Form_Load()
Combo1.AddItem "2008"
For i = 1 To 12
Combo2.AddItem i
Next i
Combo4.AddItem "2008"
For i = 1 To 12
Combo5.AddItem i
Next i
Command2.Enabled = False
command3.Enabled = False
Adodc1.Refresh
Adodc2.Refresh
Adodc3.Refresh
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -