📄 frmdzxxgl.frm
字号:
TabIndex = 3
Top = 1920
Width = 975
End
Begin VB.Label Label12
BackStyle = 0 'Transparent
Caption = "证件类型:"
ForeColor = &H000000C0&
Height = 255
Index = 0
Left = 165
TabIndex = 2
Top = 2280
Width = 975
End
Begin VB.Label Label13
BackStyle = 0 'Transparent
Caption = "证件号码:"
ForeColor = &H000000C0&
Height = 255
Index = 0
Left = 3255
TabIndex = 1
Top = 2280
Width = 975
End
End
End
Attribute VB_Name = "frmdzxxgl"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim rs As ADODB.Recordset
Private Sub Combo1_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyReturn Then DTPicker1.SetFocus
End Sub
Private Sub Combo2_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyReturn Then Text9.SetFocus
End Sub
Private Sub Combo3_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyReturn Then Combo6.SetFocus
End Sub
Private Sub Combo4_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyReturn Then DTPicker3.SetFocus
End Sub
Private Sub Combo5_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyReturn Then Text19.SetFocus
End Sub
Private Sub Combo6_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyReturn Then Text23.SetFocus
End Sub
Private Sub Command1_Click()
Dim temp1
temp1 = 100000
Adodc1.RecordSource = "select * from dzxxtb order by 读者编号"
Adodc1.Refresh
If Adodc1.Recordset.RecordCount > 0 Then
Adodc1.Recordset.MoveLast
Text1.Text = Val(Adodc1.Recordset.Fields("读者编号")) + 1
Else
Text1.Text = temp1 + "000001"
End If
Adodc1.RecordSource = "select * from dzxxtb order by 读者编号"
Adodc1.Refresh
clear1
Text6.Text = ""
Text2.SetFocus
Command3.Enabled = True
End Sub
Private Sub Command2_Click()
If Adodc1.Recordset.EOF = False Then
c = MsgBox("您确认要删除该记录吗?", 17, "提示信息")
If c = vbOK Then
Adodc1.Recordset.Delete
Adodc1.Refresh
Else
End If
Else
MsgBox "当前数据库中已经没有可删除的记录", 64, "提示信息"
End If
End Sub
Private Sub Command3_Click()
Dim sql As String
sql = "insert into dzxxtb values('" & Text1 & "','" & Text2 & "','" & Combo1 & "','" & DTPicker1 & "','" & Text3 & "','" & Text4 & "','" & Text5 & "','" & Text6 & "','" & Text7 & "','" & Text8 & "','" & Combo2 & "','" & Text9 & "','" & DTPicker2 & "','" & Text22 & "','" & Text10 & "')"
cnn.Execute (sql)
MsgBox "数据保存成功", 64, "提示信息"
Adodc1.Refresh
Adodc2.RecordSource = "select * from dzxxtb"
Adodc2.Refresh
End Sub
Private Sub Command4_Click()
Unload Me
End Sub
Private Sub Command5_Click()
If Text11.Text = "" Or Text12.Text = "" Then
MsgBox "不能修改空记录信息", , "信息提示"
Else
Dim i, sql As String
i = MsgBox("是否修改此条记录!", vbYesNo + vbOKOnly, "提示")
If i = vbYes Then
sql = "update dzxxtb set 读者编号='" & Text11 & "',读者姓名='" & Text12 & "',性别='" & Combo4 & "',出生日期='" & DTPicker3 & "',单位='" & Text13 & "',家庭住址='" & Text14 & "',家庭电话='" & Text15 & "',手机号码='" & Text16 & "',Email='" & Text18 & "',证件类型='" & Combo5 & "',证件号码='" & Text19 & "',登记日期='" & DTPicker4 & "',读者级别='" & Text20 & "',备注='" & Text21 & "' where 读者编号 like '" & Text11.Text & "'"
cnn.Execute (sql)
Adodc1.Refresh
clear
Else
On Error Resume Next
rs.CancelUpdate
End If
End If
End Sub
Private Sub Command6_Click()
Unload Me
End Sub
Private Sub Command7_Click()
Dim Counter As Integer
Dim workarea(100) As String
Counter = 0
On Error Resume Next
ProgressBar1.Value = ProgressBar1.Min
For Counter = LBound(workarea) To UBound(workarea)
Debug.Print Counter
If Check1.Value = 1 And Check2.Value = 0 Then
If Combo6.Text = "like" Then
Adodc2.RecordSource = "select * from dzxxtb where dzxxtb." & Combo3.Text & " like + '%" + Text23.Text + "%'"
Adodc2.Refresh
Else
Adodc2.RecordSource = "select * from dzxxtb where dzxxtb." & Combo3.Text & Combo6 & " + '" + Text23.Text + "'"
Adodc2.Refresh
End If
End If
If Check1.Value = 0 And Check2.Value = 1 Then
Adodc2.RecordSource = "select * from dzxxtb where 登记日期 between'" & DTPicker5.Value & "' and '" & DTPicker6.Value & "'"
Adodc2.Refresh
End If
If Check1.Value = 1 And Check2.Value = 1 Then
Select Case Combo6.Text
Case Is = "like"
Adodc2.RecordSource = "select * from dzxxtb where(" & Combo3.Text & " like '%" + Text23.Text + "%'and 登记日期 between '" & DTPicker5.Value & "' and '" & DTPicker6.Value & "')"
Adodc2.Refresh
Case Is = "="
Adodc2.RecordSource = "select * from dzxxtb where (" & Combo3.Text & " = '" + Text23.Text + "' and 登记日期 between '" & DTPicker5.Value & "' and '" & DTPicker6.Value & "')"
Adodc2.Refresh
Case Is = "<"
Adodc2.RecordSource = "select * from dzxxtb where (" & Combo3.Text & " < '" + Text23.Text + "' and 登记日期 between '" & DTPicker5.Value & "' and '" & DTPicker6.Value & "')"
Adodc2.Refresh
Case Is = ">"
Adodc2.RecordSource = "select * from dzxxtb where (" & Combo3.Text & " > '" + Text23.Text + "' and 登记日期 between '" & DTPicker5.Value & "' and '" & DTPicker6.Value & "')"
Adodc2.Refresh
Case Is = "<="
Adodc2.RecordSource = "select * from dzxxtb where (" & Combo3.Text & " <= '" + Text23.Text + "' and 登记日期 between '" & DTPicker5.Value & "' and '" & DTPicker6.Value & "')"
Adodc2.Refresh
Case Is = ">="
Adodc2.RecordSource = "select * from dzxxtb where (" & Combo3.Text & " >= '" + Text23.Text + "' and 登记日期 between '" & DTPicker5.Value & "' and '" & DTPicker6.Value & "')"
Adodc2.Refresh
End Select
End If
If Counter = 100 Then
Me.MousePointer = 0
End If
ProgressBar1.Value = Counter
Next Counter
ProgressBar1.Value = ProgressBar1.Min
ProgressBar1.Value = 0
End Sub
Private Sub Command8_Click()
Unload Me
End Sub
Private Sub DataGrid1_DblClick()
SSTab1.Tab = 1
Text11.Text = Adodc1.Recordset.Fields(0)
Text12.Text = Adodc1.Recordset.Fields(1)
Combo4.Text = Adodc1.Recordset.Fields(2)
DTPicker3.Value = Adodc1.Recordset.Fields(3)
Text13.Text = Adodc1.Recordset.Fields(4)
Text14.Text = Adodc1.Recordset.Fields(5)
Text15.Text = Adodc1.Recordset.Fields(6)
Text16.Text = Adodc1.Recordset.Fields(7)
Text17.Text = Adodc1.Recordset.Fields(8)
Text18.Text = Adodc1.Recordset.Fields(9)
Combo5.Text = Adodc1.Recordset.Fields(10)
Text19.Text = Adodc1.Recordset.Fields(11)
DTPicker4.Value = Adodc1.Recordset.Fields(12)
Text20.Text = Adodc1.Recordset.Fields(13)
Text21.Text = Adodc1.Recordset.Fields(14)
End Sub
Private Sub DTPicker1_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyReturn Then Text3.SetFocus
End Sub
Private Sub DTPicker2_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then
Text10.SetFocus
Else
End If
End Sub
Private Sub DTPicker3_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyReturn Then Text13.SetFocus
End Sub
Private Sub DTPicker5_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyReturn Then DTPicker6.SetFocus
End Sub
Private Sub Form_Activate()
Combo1.AddItem "男"
Combo1.AddItem "女"
Combo2.AddItem "学生证"
Combo2.AddItem "教师证"
Combo2.AddItem "工作证"
Combo2.AddItem "身份证"
Combo4.AddItem "男"
Combo4.AddItem "女"
Combo5.AddItem "学生证"
Combo5.AddItem "教师证"
Combo5.AddItem "工作证"
Combo5.AddItem "身份证"
Combo3.AddItem "读者编号"
Combo3.AddItem "读者姓名"
Combo3.AddItem "性别"
Combo3.AddItem "单位"
Combo3.AddItem "家庭电话"
Combo3.AddItem "手机号码"
Combo3.AddItem "传真号码"
Combo3.AddItem "证件类型"
Combo3.AddItem "证件号码"
Combo3.AddItem "读者级别"
Combo6.AddItem "like"
Combo6.AddItem "="
Combo6.AddItem "<"
Combo6.AddItem ">"
Combo6.AddItem "<="
Combo6.AddItem ">="
DTPicker1.Value = Date
DTPicker2.Value = Date
DTPicker5.Value = Date
DTPicker6.Value = Date + 30
End Sub
Private Sub Form_Load()
Set rs = New ADODB.Recordset
Me.Caption = Me.Caption & " " & frmmain.StatusBar1.Panels(2).Text
End Sub
Sub clear()
Text11.Text = ""
Text12.Text = ""
Combo4.Text = ""
Text13.Text = ""
Text14.Text = ""
Text15.Text = ""
Text16.Text = ""
Text17.Text = ""
Text18.Text = ""
Combo5.Text = ""
Text19.Text = ""
Text20.Text = ""
Text21.Text = ""
Text6.Text = ""
End Sub
Private Sub Text1_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyReturn Then Text2.SetFocus
End Sub
Private Sub Text2_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyReturn Then Combo1.SetFocus
End Sub
Private Sub Text23_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyReturn Then DTPicker5.SetFocus
End Sub
Private Sub Text3_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyReturn Then Text4.SetFocus
End Sub
Private Sub Text4_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyReturn Then Text5.SetFocus
End Sub
Private Sub text5_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyReturn Then Text6.SetFocus
End Sub
Private Sub Text6_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyReturn Then Text7.SetFocus
End Sub
Private Sub Text7_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyReturn Then Text8.SetFocus
End Sub
Private Sub Text8_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyReturn Then Combo2.SetFocus
End Sub
Private Sub Text9_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyReturn Then DTPicker2.SetFocus
End Sub
Private Sub Text10_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyReturn Then Text22.SetFocus
End Sub
Private Sub Text11_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyReturn Then Text12.SetFocus
End Sub
Private Sub Text12_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyReturn Then Combo4.SetFocus
End Sub
Private Sub Text13_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyReturn Then Text14.SetFocus
End Sub
Private Sub Text14_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyReturn Then Text15.SetFocus
End Sub
Private Sub Text15_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyReturn Then Text16.SetFocus
End Sub
Private Sub Text16_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyReturn Then Text17.SetFocus
End Sub
Private Sub Text17_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyReturn Then Text18.SetFocus
End Sub
Private Sub Text18_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyReturn Then Combo5.SetFocus
End Sub
Private Sub Text19_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyReturn Then DTPicker4.SetFocus
End Sub
Private Sub Text20_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyReturn Then Text21.SetFocus
End Sub
Sub clear1()
Text2.Text = ""
Combo1.Text = ""
Text3.Text = ""
Text4.Text = ""
Text5.Text = ""
Text5.Text = ""
Text7.Text = ""
Text8.Text = ""
Combo2.Text = ""
Text9.Text = ""
DTPicker2.Value = Date
Text10.Text = ""
Text22.Text = ""
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -