📄 frmhuanshu.frm
字号:
Top = 1320
Width = 1695
End
Begin VB.TextBox Text1
Height = 375
Left = 1560
TabIndex = 0
Top = 360
Width = 1695
End
Begin VB.Label Label5
AutoSize = -1 'True
Caption = "备注"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 210
Left = 6600
TabIndex = 8
Top = 600
Width = 420
End
Begin VB.Label Label4
AutoSize = -1 'True
Caption = "还书日期"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 210
Left = 3480
TabIndex = 7
Top = 480
Width = 840
End
Begin VB.Label Label3
AutoSize = -1 'True
Caption = "图书编号 "
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 210
Left = 480
TabIndex = 6
Top = 1440
Width = 945
End
Begin VB.Label Label2
AutoSize = -1 'True
Caption = "超期罚金"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 210
Left = 3480
TabIndex = 5
Top = 1440
Width = 840
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "卡号"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 210
Left = 600
TabIndex = 4
Top = 360
Width = 420
End
End
Attribute VB_Name = "frmhuanshu"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim i As Integer '用于FOR循环中的变量
Dim StrNum As Long '定义一个用于保存窗口信息的变量
Dim sum As Integer
Dim date1 As Date
Dim num As Integer
Dim num1 As Integer
Private Sub Command1_Click()
End Sub
Private Sub Cmd_Add_Click()
On Error Resume Next
Adodc1.RecordSource = "select * from 还书总表 order by 卡号"
Adodc1.Refresh
Text1.SetFocus
cmd_save.Enabled = True
cmd_del.Enabled = False
End Sub
Private Sub Cmd_del_Click()
If Text1.Text = "" Then
MsgBox "请选择您要删除的记录!", 48, "提示"
Exit Sub
End If
If Adodc1.Recordset.EOF = False Then
c = MsgBox("您确认要删除该记录吗?", 17, "删除提示信息")
If c = vbOK Then
If Text1.Text = "" Then
MsgBox "请选择您要删除的记录!", 48, "提示"
Else
Adodc1.Recordset.Delete '删除所选中的记录信息
Adodc1.Refresh
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
cmd_del.Enabled = False
Call TRefresh '调用数据刷新过程
End If
End If
Else
MsgBox "当前数据库中已经没有可删除的记录", 64, "提示信息"
End If
End Sub
Private Sub cmd_exit_Click()
Unload Me
End Sub
Private Sub Cmd_save_Click()
'''''*****************************************************************************************************
Text5.Text = "0"
c = MsgBox("您确认要保存该信息吗?", 33, "保存信息提示")
If c = vbOK Then
'限制输入的部分信息不能为空值
If Text1.Text = "" Or Text2.Text = "" Then
MsgBox "输入信息不完全!", 48, "保存信息提示"
Else
Call main
adoRs.Open "select * from 借阅总表 where 书号= '" + Text4.Text + "'and 卡号= '" + Text1.Text + "' and 还否= '" + Text5.Text + "'", adoCon, adOpenKeyset, adLockOptimistic
If adoRs.RecordCount <= 0 Then
MsgBox "借阅总表里无此卡号未还信息,可能原因:" & vbCrLf & "此卡号未曾借过此书," & vbCrLf & "此书已还," & vbCrLf & "请重新输入...", 48, "保存信息提示"
adoRs.Close
adoCon.Close
Exit Sub
Else
adoRs.Close
adoCon.Close
Call main
Text5.Text = "是"
adoCon.Execute ("update 借阅总表 set 还否 = '" + Text5.Text + "' where 书号= '" + Text4.Text + "'and 卡号= '" + Text1.Text + "'")
'' adoCon.Close
'' Call main '调用公共模块中的连接数据库过程
adoCon.Execute ("update 书籍总表 set 数量=数量+1 where 书号= '" + Text4.Text + "'")
'' adoCon.Close
'' Call main '调用公共模块中的连接数据库过程
adoCon.Execute ("update 图书卡 set 已借书数=已借书数-1 where 卡号= '" + Text1.Text + "'")
'' adoCon.Close
'' Call main '调用公共模块中的连接数据库过程
Set adoRs = adoCon.Execute("select * from 借阅总表 where 卡号= '" + Text1.Text + "' and 书号='" + Text4.Text + "'")
If Date > adoRs.Fields("截止日期") Then
MsgBox "该书已超期!"
End If
'' adoCon.Close
'' Call main '调用公共模块中的连接数据库过程
adoCon.Execute ("insert into 还书总表 values ('" & Text1.Text & "','" & Text4.Text & "','" & Str(DTPicker1.Value) & "','" & Text2.Text & "','" & Text3.Text & "')")
adoCon.Close
End If
End If
End If
Call TRefresh
End Sub
Private Sub DataGrid1_RowColChange(LastRow As Variant, ByVal LastCol As Integer)
Call JionBack '调用数据信息反绑定过程
cmd_del.Enabled = True
cmd_save.Enabled = False
End Sub
Private Sub Form_Load()
Text1.Text = "" '防止frmstudent带来作废数据
Me.Left = (Screen.Width - Me.Width) / 2
Me.Top = (Screen.Height - Me.Height) / 2
DTPicker1.Value = Date
Text2.Text = "0"
Text3.Text = "无"
End Sub
' 自定义数据信息反绑定的过程
Private Sub JionBack()
On Error Resume Next '执行错误处理
Dim SLen As Integer
If Adodc1.Recordset.RecordCount > 0 Then
Text1.Text = Trim(Adodc1.Recordset(0))
Text4.Text = Trim(Adodc1.Recordset(1))
DTPicker1.Value = Trim(Adodc1.Recordset(2))
Text2.Text = Trim(Adodc1.Recordset(3))
Text3.Text = Trim(Adodc1.Recordset(4))
'将数据信息反绑定到文本框当中
End If
End Sub
' 自定义数据刷新的过程
Private Sub TRefresh()
Adodc1.RecordSource = "select * from 还书总表 order by 卡号"
Adodc1.Refresh
End Sub
Private Sub Form_Unload(Cancel As Integer)
frmbanka.Frame2.Visible = False
frmtushu.Frame2.Visible = False
End Sub
Private Sub Text1_Click()
frmbanka.Frame2.Visible = True '''''''''''''''''记得UNLOAD ME 时,改回,呵{{{{
frmbanka.Show 1
End Sub
Private Sub Text4_Click()
frmtushu.Frame2.Visible = True
frmtushu.Show 1
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -