📄 frm_jsrydj.frm
字号:
Left = 120
TabIndex = 28
Top = 1320
Width = 840
End
Begin VB.Label Label5
Caption = "出生日期"
Height = 315
Left = 120
TabIndex = 27
Top = 1665
Width = 930
End
Begin VB.Label Label9
Caption = "证件有效期"
Height = 255
Left = 120
TabIndex = 26
Top = 3150
Width = 930
End
Begin VB.Label Label11
Caption = "车本类型"
Height = 270
Left = 135
TabIndex = 25
Top = 4005
Width = 975
End
Begin VB.Line Line1
BorderColor = &H00008000&
Index = 1
X1 = 120
X2 = 8100
Y1 = 3825
Y2 = 3825
End
Begin VB.Line Line2
BorderColor = &H00008000&
Index = 1
X1 = 120
X2 = 8100
Y1 = 3855
Y2 = 3855
End
Begin VB.Label Label15
Caption = "事故记录"
Height = 210
Left = 4230
TabIndex = 16
Top = 4410
Width = 750
End
Begin VB.Label Label14
Caption = "年检记录"
Height = 195
Left = 120
TabIndex = 15
Top = 4350
Width = 735
End
Begin VB.Label Label13
Caption = "手机"
Height = 240
Left = 6120
TabIndex = 14
Top = 4035
Width = 465
End
Begin VB.Label Label12
Caption = "单位或住址"
Height = 285
Left = 2505
TabIndex = 12
Top = 3990
Width = 975
End
Begin VB.Label Label10
Caption = "驾龄"
Height = 225
Left = 120
TabIndex = 9
Top = 3510
Width = 735
End
Begin VB.Label Label8
Caption = "领证日期"
Height = 285
Left = 120
TabIndex = 8
Top = 2775
Width = 780
End
Begin VB.Label Label7
Caption = "档案编号"
Height = 270
Left = 120
TabIndex = 7
Top = 2385
Width = 840
End
Begin VB.Line Line2
BorderColor = &H00008000&
Index = 0
X1 = 150
X2 = 8085
Y1 = 4725
Y2 = 4725
End
Begin VB.Label Label6
Caption = "身份证号"
Height = 270
Left = 120
TabIndex = 5
Top = 2010
Width = 885
End
Begin VB.Label Label3
Caption = "姓名"
Height = 210
Left = 120
TabIndex = 4
Top = 960
Width = 585
End
Begin VB.Label Label2
Caption = "记录修改人"
Height = 255
Left = 6015
TabIndex = 2
Top = 4905
Width = 960
End
Begin VB.Label Label1
Caption = "记录修改日期"
Height = 225
Left = 3435
TabIndex = 0
Top = 4920
Width = 1140
End
Begin VB.Line Line1
BorderColor = &H00008000&
Index = 0
X1 = 150
X2 = 8085
Y1 = 4695
Y2 = 4695
End
End
Attribute VB_Name = "frm_jsrydj"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim i As Integer
Dim c
Public StrCodes As PeopleCode
Private Sub Cbx_lx_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then
Text1(5).SetFocus
End If
End Sub
Private Sub Cbx_xb_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then
DT1.SetFocus
End If
End Sub
Private Sub Dgr_Sjll_Click()
On Error Resume Next
If Adodc1.Recordset.RecordCount > 0 Then
Text1(0).Text = Adodc1.Recordset.Fields(1)
Cbx_xb.Text = Adodc1.Recordset.Fields(2)
DT1.Value = Adodc1.Recordset.Fields(3)
Text1(1).Text = Adodc1.Recordset.Fields(4)
Text1(2).Text = Adodc1.Recordset.Fields(5)
DT2.Value = Adodc1.Recordset.Fields(6)
Text1(3).Text = Adodc1.Recordset.Fields(7)
Text1(4).Text = Adodc1.Recordset.Fields(8)
Cbx_lx.Text = Adodc1.Recordset.Fields(9)
Text1(5).Text = Adodc1.Recordset.Fields(10)
Text1(6) = Adodc1.Recordset.Fields(11)
Text1(7) = Adodc1.Recordset.Fields(12)
Text1(8).Text = Adodc1.Recordset.Fields(13)
Txt_Date.Text = Adodc1.Recordset.Fields(14)
Txt_xgr.Text = Adodc1.Recordset.Fields(15)
End If
End Sub
Private Sub DT1_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then
Text1(1).SetFocus
End If
End Sub
Private Sub DT2_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then
Text1(3).SetFocus
End If
End Sub
Private Sub DT3_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then
Cbx_xz.SetFocus
End If
End Sub
Private Sub Form_Load()
DT1.Value = Date
DT2.Value = Date
Call LoadFile
Adodc1.ConnectionString = PublicStr
Adodc1.RecordSource = "select * from 驾驶人员登记 order by 编号"
Adodc1.Refresh
Call Tbr_cortrol(Tbr_xxcz, True)
End Sub
Private Sub Tbr_xxcz_ButtonClick(ByVal Button As MSComctlLib.Button)
Select Case Button.Key
Case "Add"
Call Tbr_cortrol(Tbr_xxcz, False)
AdoRs.Open "select * from 驾驶人员登记 order by 编号", Cnn, adOpenKeyset
If AdoRs.RecordCount > 0 Then
AdoRs.MoveLast
StrNum = AdoRs.Fields("编号") + 1
Else
StrNum = 1
End If
AdoRs.Close
For i = 0 To 8
Text1(i).Text = ""
Text1(i).Locked = False
Next i
Cbx_lx.Text = ""
Text1(0).SetFocus
Case "Del" '删除信息
Call Deletes
Case "Edit" '修改信息
Call Edits
Case "Save" '保存信息
Call Saves
Case "Cancel"
Call Tbr_cortrol(Tbr_xxcz, True)
For i = 1 To 8
Text1(i).Text = ""
Text1(0).SetFocus
Text1(i).Locked = True
Next i
Adodc1.RecordSource = "select * from 驾驶人员登记 order by 编号"
Adodc1.Refresh
Case "Exit"
Unload Me
End Select
End Sub
Private Sub Text1_KeyDown(Index As Integer, KeyCode As Integer, Shift As Integer)
On Error Resume Next
If KeyCode = 13 Then
If Index = 0 Then
Cbx_xb.SetFocus
Exit Sub
ElseIf Index = 1 Then '自动计算身份证号的位数、出生日期和性别
Set StrCodes = New PeopleCode
StrCodes.PeopleCode (Text1(1).Text)
DT1.Value = StrCodes.PeopleBirth
Cbx_xb.Text = StrCodes.PeopleSex
Text1(1).Text = StrCodes.PeopleCodes
Text1(2).SetFocus
Exit Sub
ElseIf Index = 2 Then
DT2.SetFocus
Exit Sub
ElseIf Index = 4 Then
Cbx_lx.SetFocus
Exit Sub
End If
End If
If KeyCode = 38 Then
If Index = 5 Then
Cbx_lx.SetFocus
Exit Sub
ElseIf Index = 3 Then
DT2.SetFocus
Exit Sub
ElseIf Index = 1 Then
DT1.SetFocus
Exit Sub
End If
End If
If Index < 9 And KeyCode = 38 Then Text1(Index - 1).SetFocus
If Index >= 0 And KeyCode = 13 Then Text1(Index + 1).SetFocus
If Index = 8 And KeyCode = 13 Then
Call Saves
End If
End Sub
Private Sub Saves() '保存信息的事件过程
If Text1(0).Text = "" Or Text1(1).Text = "" Then
MsgBox "重要信息不能为空值", 48, "提示信息"
Else
AdoRs.Open "select * from 驾驶人员登记 where 姓名='" + Text1(0).Text + "'", Cnn, adOpenKeyset
If AdoRs.RecordCount > 0 Then
MsgBox "该信息已经存在", 48, "提示信息"
AdoRs.Close
Else
AdoRs.Close
c = MsgBox("确认保存信息吗?", 33, "提示信息")
If c = vbOK Then
Set AdoRs = Cnn.Execute("insert into 驾驶人员登记 values(" & StrNum & ",'" & Text1(0) _
& "','" & Cbx_xb & "','" & STR(DT1.Value) & "','" & Text1(1) & "','" & Text1(2) & "','" & STR(DT2.Value) & "','" & Text1(3) & "','" & Text1(4) & "','" & Cbx_lx & "','" & Text1(5) & "','" & Text1(6) & "','" _
& Text1(7) & "','" & Text1(8) & "',' ',' ')")
MsgBox "数据保存成功", 64, "提示信息"
Adodc1.RecordSource = "select * from 驾驶人员登记 order by 编号"
Adodc1.Refresh
Else
End If
End If
Call Tbr_cortrol(Tbr_xxcz, True)
End If
End Sub
Private Sub Edits() '修改信息的事件过程
c = MsgBox("确认修改信息吗?", 33, "提示信息")
If c = vbOK Then
Set AdoRs = Cnn.Execute("UPDATE 驾驶人员登记 SET 姓名='" + Text1(0) + "',性别='" + Cbx_xb + "',出生日期='" + STR(DT1.Value) + "',身份证号='" _
+ Text1(1) + "',档案编号='" + Text1(2) + "',领证日期='" + STR(DT2.Value) + "',证件有效期='" + Text1(3) + "',驾龄='" + Text1(4) + "',车本类型='" + Cbx_lx + "',单位或住址='" + Text1(5) + "',手机='" + Text1(6) _
+ "',年检记录='" + Text1(7) + "',事故记录='" + Text1(8) + "',记录修改日期='" + STR(Date) + "',记录修改人='" + Name1 + "' where 姓名='" + Text1(0).Text + "'")
MsgBox "数据修改成功", 64, "提示信息"
Adodc1.RecordSource = "select * from 驾驶人员登记 order by 编号"
Adodc1.Refresh
StrId = Text1(0).Text
StrTitle = Text1(1).Text
Call joinRZ
Else
End If
End Sub
Private Sub LoadFile()
On Error Resume Next
AdoRs.Open "select * from 驾驶人员登记", Cnn, adOpenKeyset
If AdoRs.RecordCount > 0 Then
Text1(0).Text = AdoRs.Fields(1)
Cbx_xb.Text = AdoRs.Fields(2)
DT1.Value = AdoRs.Fields(3)
Text1(1).Text = AdoRs.Fields(4)
Text1(2).Text = AdoRs.Fields(5)
DT2.Value = AdoRs.Fields(6)
Text1(3).Text = AdoRs.Fields(7)
Text1(4).Text = AdoRs.Fields(8)
Cbx_lx.Text = AdoRs.Fields(9)
Text1(5).Text = AdoRs.Fields(10)
Text1(6) = AdoRs.Fields(11)
Text1(7) = AdoRs.Fields(12)
Text1(8).Text = AdoRs.Fields(13)
Txt_Date.Text = AdoRs.Fields(14)
Txt_xgr.Text = AdoRs.Fields(15)
End If
AdoRs.Close
End Sub
Private Sub Deletes() '删除信息
c = MsgBox("确认删除该信息吗?", 17, "提示信息")
If c = vbOK Then
Set AdoRs = Cnn.Execute("Delete 驾驶人员登记 from 驾驶人员登记 where 姓名='" + Text1(0).Text + "'")
Adodc1.RecordSource = "select * from 驾驶人员登记 order by 编号"
Adodc1.Refresh
End If
For i = 0 To 8
Text1(i).Text = ""
Next i
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -