📄 frmjieshu.frm
字号:
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H80000008&
Height = 375
Left = 3720
MaskColor = &H8000000E&
TabIndex = 9
Top = 2520
Width = 855
End
Begin MSComCtl2.DTPicker DTPicker2
Height = 375
Left = 1440
TabIndex = 8
Top = 2520
Width = 1575
_ExtentX = 2778
_ExtentY = 661
_Version = 393216
Enabled = 0 'False
Format = 21430273
CurrentDate = 29543
End
Begin MSComCtl2.DTPicker DTPicker1
Height = 375
Left = 1440
TabIndex = 7
Top = 1680
Width = 1575
_ExtentX = 2778
_ExtentY = 661
_Version = 393216
Enabled = 0 'False
Format = 21430273
CurrentDate = 29543
End
Begin VB.TextBox Text2
Height = 375
Left = 1440
TabIndex = 6
Top = 1080
Width = 1695
End
Begin VB.TextBox Text1
Height = 375
Left = 1440
TabIndex = 5
Top = 360
Width = 1695
End
Begin VB.Label Label6
AutoSize = -1 'True
Caption = "持书时间为一个月"
Height = 180
Left = 1440
TabIndex = 19
Top = 2160
Width = 1440
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 = 3840
TabIndex = 4
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 = 120
TabIndex = 3
Top = 2520
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 = 120
TabIndex = 2
Top = 1800
Width = 840
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 = 480
TabIndex = 1
Top = 1200
Width = 420
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 = 360
TabIndex = 0
Top = 360
Width = 420
End
End
Attribute VB_Name = "frmjieshu"
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 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 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()
Check1.Value = 0
c = MsgBox("您确认要保存该信息吗?", 33, "保存信息提示")
If c = vbOK Then
'限制输入的部分信息不能为空值
If Text1.Text = "" Or Text2.Text = "" Then
MsgBox "输入信息不完全!", 48, "保存信息提示"
Else
Adodc2.RecordSource = "select * from 书籍总表 where 书号= '" + Text2.Text + "'"
Adodc2.Refresh
sum = Adodc2.Recordset.Fields("数量")
Text5.Text = sum - 1
If sum = 0 Then
MsgBox "此书已没有库存了!", 48, "保存信息提示"
Exit Sub
Else
Adodc2.RecordSource = "select * from 图书卡 where 卡号= '" + Text1.Text + "'"
Adodc2.Refresh
date1 = Adodc2.Recordset.Fields("有效截止日期")
If Date > date1 Then
MsgBox "此卡已不在有效期内!", 48, "保存信息提示"
Exit Sub
Else
num = Adodc2.Recordset.Fields("最大允许借出数")
num1 = Adodc2.Recordset.Fields("已借书数")
If num1 = num Then
MsgBox "您借书已超过最大数量!", 48, "保存信息提示"
Exit Sub
Else
Call main '调用公共模块中的连接数据库过程
Text4.Text = num1 + 1
adoCon.Execute ("update 图书卡 set 已借书数 = '" + Text4.Text + "' where 卡号= '" + Text1.Text + "'")
adoCon.Execute ("update 书籍总表 set 数量 = '" + Text5.Text + "' where 书号= '" + Text2.Text + "'")
adoCon.Execute ("insert into 借阅总表 values ('" & Text1.Text & "','" & Text2.Text & "','" & Str(DTPicker1.Value) & "','" & Str(DTPicker2.Value) & "','" & Check1.Value & "','" & Text3.Text & "')")
adoCon.Close
End If
End If
End If
End If
End If
Call JionBack
Adodc1.RecordSource = " select * from 借阅总表"
Adodc1.Refresh
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
DTPicker2 = Date
DTPicker1 = Date + 30
Adodc1.RecordSource = "select * from 借阅总表"
Adodc1.Refresh
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))
Text2.Text = Trim(Adodc1.Recordset(1))
DTPicker1.Value = Trim(Adodc1.Recordset(2))
DTPicker2.Value = Trim(Adodc1.Recordset(3))
Combo1.Text = Trim(Adodc1.Recordset(4))
'将数据信息反绑定到文本框当中
If Trim(Adodc1.Recordset(4)) = "是" Then
Check1.Value = 1
Else
Check1.Value = 0
End If
End If
End Sub
' 自定义数据刷新的过程
Private Sub TRefresh()
Adodc1.RecordSource = "select * from 图书卡 order by 学号"
Adodc1.Refresh
End Sub
Private Sub Text2_Click()
frmtushu.Frame2.Visible = True
frmtushu.Show 1
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -