📄 frmreaderdoc.frm
字号:
Caption = "取消"
Key = "btnCancel"
ImageIndex = 9
EndProperty
BeginProperty Button10 {66833FEA-8583-11D1-B16A-00C0F0283628}
Caption = "退出"
Key = "btnExit"
ImageIndex = 10
EndProperty
EndProperty
Begin MSComctlLib.ImageList ImageList1
Left = 7440
Top = 0
_ExtentX = 1005
_ExtentY = 1005
BackColor = -2147483643
ImageWidth = 16
ImageHeight = 16
MaskColor = 12632256
_Version = 393216
BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628}
NumListImages = 10
BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "frmReaderDoc.frx":046C
Key = ""
EndProperty
BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "frmReaderDoc.frx":057E
Key = ""
EndProperty
BeginProperty ListImage3 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "frmReaderDoc.frx":0690
Key = ""
EndProperty
BeginProperty ListImage4 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "frmReaderDoc.frx":07A2
Key = ""
EndProperty
BeginProperty ListImage5 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "frmReaderDoc.frx":08B4
Key = ""
EndProperty
BeginProperty ListImage6 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "frmReaderDoc.frx":09C6
Key = ""
EndProperty
BeginProperty ListImage7 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "frmReaderDoc.frx":0AD8
Key = ""
EndProperty
BeginProperty ListImage8 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "frmReaderDoc.frx":0BEA
Key = ""
EndProperty
BeginProperty ListImage9 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "frmReaderDoc.frx":0CFC
Key = ""
EndProperty
BeginProperty ListImage10 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "frmReaderDoc.frx":0E0E
Key = ""
EndProperty
EndProperty
End
End
Begin VB.Label Label17
Caption = "备注"
Height = 255
Left = 7200
TabIndex = 36
Top = 5160
Width = 735
End
Begin VB.Label Label16
Caption = "操作员"
Height = 255
Left = 5520
TabIndex = 31
Top = 5880
Width = 1095
End
Begin VB.Label Label15
Caption = "图书借阅次数"
Height = 255
Left = 3600
TabIndex = 30
Top = 5880
Width = 1095
End
Begin VB.Label Label14
Caption = "有限期至"
Height = 255
Left = 1920
TabIndex = 29
Top = 5880
Width = 975
End
Begin VB.Label Label13
Caption = "登记日期"
Height = 255
Left = 120
TabIndex = 27
Top = 5880
Width = 855
End
Begin VB.Label Label12
Caption = "出生日期"
Height = 255
Left = 5640
TabIndex = 26
Top = 5160
Width = 855
End
Begin VB.Label Label11
Caption = "证件号码"
Height = 255
Left = 3720
TabIndex = 24
Top = 5160
Width = 975
End
Begin VB.Label Label10
Caption = "有效证件"
Height = 255
Left = 2040
TabIndex = 22
Top = 5160
Width = 855
End
Begin VB.Label Label9
Caption = "联系方式"
Height = 255
Left = 120
TabIndex = 21
Top = 5160
Width = 975
End
Begin VB.Label Label8
Caption = "类型"
Height = 255
Left = 7320
TabIndex = 19
Top = 4440
Width = 975
End
Begin VB.Label Label4
Caption = "条形码"
Height = 255
Left = 120
TabIndex = 14
Top = 4440
Width = 615
End
Begin VB.Label Label5
Caption = "编号"
Height = 255
Left = 1920
TabIndex = 13
Top = 4440
Width = 855
End
Begin VB.Label Label6
Caption = "姓名"
Height = 255
Left = 3840
TabIndex = 12
Top = 4440
Width = 735
End
Begin VB.Label Label7
Caption = "性别"
Height = 255
Left = 5640
TabIndex = 11
Top = 4440
Width = 735
End
End
Attribute VB_Name = "frmReaderDoc"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private bAdd As Boolean
'读入数据表
Private Sub LoadData()
Dim strFilter As String
Dim db As New DataBases
Dim rs As Recordset
If Len(Trim(txbOne.Text)) = 0 Then
If Len(Trim(txbTwo.Text)) = 0 Then
If Len(Trim(txbThree.Text)) = 0 Then
strFilter = ""
Else
strFilter = "where 姓名 like '"
strFilter = strFilter + Trim(txbThree.Text) + "%'"
End If
Else
strFilter = "where 编号 like '"
strFilter = strFilter + Trim(txbTwo.Text) + "%'"
If Len(Trim(txbThree.Text)) <> 0 Then
strFilter = strFilter + " and 姓名 like '"
strFilter = strFilter + Trim(txbThree.Text) + "%'"
End If
End If
Else
strFilter = "where 条形码 like '"
strFilter = strFilter + Trim(txbOne.Text) + "%'"
If Len(Trim(txbTwo.Text)) <> 0 Then
strFilter = strFilter + " and 编号 like '"
strFilter = strFilter + Trim(txbTwo.Text) + "%'"
If Len(Trim(txbThree.Text)) <> 0 Then
strFilter = strFilter + " and 姓名 like '"
strFilter = strFilter + Trim(txbThree.Text) + "%'"
End If
Else
If Len(Trim(txbThree.Text)) <> 0 Then
strFilter = strFilter + " and 姓名 like '"
strFilter = strFilter + Trim(txbThree.Text) + "%'"
End If
End If
End If
Set rs = db.RunSelectSQLUpdatable("select * from 读者信息 " + strFilter)
'根据查询条件重新填充DataGrid
Set Adodc1.Recordset = rs
End Sub
Private Sub btnSearch_Click()
LoadData
End Sub
'选择出生日期
Private Sub Calendar1_DblClick()
Me.txbBirth.Text = Calendar1.Value
Calendar1.Visible = False
End Sub
'选择注册日期
Private Sub Calendar2_DblClick()
Me.txbRegister.Text = Calendar2.Value
Calendar2.Visible = False
End Sub
'选择有效日期
Private Sub Calendar3_DblClick()
Me.txbEnd.Text = Calendar3.Value
Calendar3.Visible = False
End Sub
Private Sub Form_Load()
Dim db As New DataBases
Adodc1.ConnectionString = db.sConn
Adodc2.ConnectionString = db.sConn
'性别
cbbSex.AddItem ("男")
cbbSex.AddItem ("女")
'有效证件
cbbPaper.AddItem ("公务员证")
cbbPaper.AddItem ("教师证")
cbbPaper.AddItem ("学生证")
cbbPaper.AddItem ("身份证")
cbbPaper.AddItem ("其它证件")
LoadData
SetTextBoxState (False)
End Sub
'设置ToolBar按钮状态
Private Sub SetToolBarState(ByVal bState As Boolean)
'设置Button的是否能够单击
Toolbar1.Buttons("btnFirst").Enabled = bState
Toolbar1.Buttons("btnBefore").Enabled = bState
Toolbar1.Buttons("btnNext").Enabled = bState
Toolbar1.Buttons("btnLast").Enabled = bState
Toolbar1.Buttons("btnNew").Enabled = bState
Toolbar1.Buttons("btnModify").Enabled = bState
Toolbar1.Buttons("btnDelete").Enabled = bState
Toolbar1.Buttons("btnSave").Enabled = Not bState
Toolbar1.Buttons("btnCancel").Enabled = Not bState
End Sub
'设置输入框状态
Private Sub SetTextBoxState(ByVal bState As Boolean)
Me.txbCode.Enabled = bState
Me.txbNumber.Enabled = bState
Me.txbName.Enabled = bState
Me.cbbSex.Enabled = bState
Me.cbbType.Enabled = bState
Me.cbbGuaShi.Enabled = bState
Me.txbContact.Enabled = bState
Me.cbbPaper.Enabled = bState
Me.txbPaperID.Enabled = bState
Me.txbBirth.Enabled = bState
Me.txbRemark.Enabled = bState
Me.txbRegister.Enabled = bState
Me.txbEnd.Enabled = bState
Me.txbTimes.Enabled = bState
Me.txbWorker.Enabled = bState
Me.grdDataGrid.Enabled = Not bState
End Sub
'清除输入框
Private Sub Clear()
Me.txbCode.Text = ""
Me.txbNumber.Text = ""
Me.txbName.Text = ""
Me.cbbSex.Text = ""
Me.cbbType.Text = Me.cbbType.RowMember
Me.cbbGuaShi.Value = 0
Me.txbContact.Text = ""
Me.cbbPaper.Text = ""
Me.txbPaperID.Text = ""
Me.txbBirth.Text = ""
Me.txbRemark.Text = ""
Me.txbRegister.Text = ""
Me.txbEnd.Text = ""
Me.txbTimes.Text = ""
Me.txbWorker.Text = ""
End Sub
'实现修改功能
Private Sub SaveForUpdate()
Adodc1.Recordset.UpdateBatch adAffectAll
End Sub
'实现删除功能
Private Sub DeleteData()
Adodc1.Recordset.Delete adAffectCurrent
Adodc1.Recordset.UpdateBatch adAffectAll
End Sub
'实现增加功能
Private Sub SaveForAdd()
Dim db As New DataBases
Dim strSQL As String
If Trim(cbbType.Text) = "" Then
MsgBox "请选择读者类型"
Exit Sub
End If
strSQL = "insert into 读者信息(条形码, 编号, 姓名, 性别, 类型, 有效证件, 证件号码, 联系方式, 登记日期, 有限期至, 是否挂失, 图书借阅次数, 操作员, 出生日期, 备注) values ('"
strSQL = strSQL + Trim(txbCode.Text) + "','"
strSQL = strSQL + Trim(txbNumber.Text) + "','"
strSQL = strSQL + Trim(txbName.Text) + "','"
strSQL = strSQL + Trim(cbbSex.Text) + "','"
strSQL = strSQL + Trim(cbbType.Text) + "','"
strSQL = strSQL + Trim(cbbPaper.Text) + "','"
strSQL = strSQL + Trim(txbPaperID.Text) + "','"
strSQL = strSQL + Trim(txbContact.Text) + "','"
strSQL = strSQL + Trim(txbRegister.Text) + "','"
strSQL = strSQL + Trim(txbEnd.Text) + "','"
strSQL = strSQL + Trim(cbbGuaShi.Value) + "','"
strSQL = strSQL + Trim(txbTimes.Text) + "','"
strSQL = strSQL + Trim(txbWorker.Text) + "','"
strSQL = strSQL + Trim(txbBirth.Text) + "','"
strSQL = strSQL + Trim(txbRemark.Text) + "')"
db.RunSelectSQL (strSQL)
End Sub
Private Sub Toolbar1_ButtonClick(ByVal Button As MSComctlLib.Button)
If StrComp(Button.Key, "btnFirst") = 0 Then
Adodc1.Recordset.MoveFirst
ElseIf StrComp(Button.Key, "btnBefore") = 0 Then
Adodc1.Recordset.MovePrevious
ElseIf StrComp(Button.Key, "btnNext") = 0 Then
Adodc1.Recordset.MoveNext
ElseIf StrComp(Button.Key, "btnLast") = 0 Then
Adodc1.Recordset.MoveLast
ElseIf StrComp(Button.Key, "btnNew") = 0 Then
bAdd = True
Adodc1.Recordset.AddNew
SetTextBoxState (True)
SetToolBarState (False)
Clear
ElseIf StrComp(Button.Key, "btnModify") = 0 Then
bAdd = False
SetTextBoxState (True)
SetToolBarState (False)
ElseIf StrComp(Button.Key, "btnDelete") = 0 Then
If MsgBox("确定要删除吗?", vbYesNo) = vbYes Then
DeleteData
End If
ElseIf StrComp(Button.Key, "btnSave") = 0 Then
SetTextBoxState (False)
SetToolBarState (True)
If bAdd = True Then
'为新增数据保存
SaveForAdd
Adodc1.Recordset.CancelUpdate
Adodc1.Recordset.Requery
Else
'为更新数据保存
SaveForUpdate
End If
ElseIf StrComp(Button.Key, "btnCancel") = 0 Then
Adodc1.Recordset.CancelUpdate
Adodc1.Recordset.Requery
SetTextBoxState (False)
SetToolBarState (True)
ElseIf StrComp(Button.Key, "btnExit") = 0 Then
Hide
End If
End Sub
Private Sub txbBirth_Click()
Calendar1.Visible = True
End Sub
Private Sub txbEnd_Click()
Calendar3.Visible = True
End Sub
Private Sub txbRegister_Click()
Calendar2.Visible = True
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -