📄 frm_sjxx.frm
字号:
Private Sub Cbx_xl_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then
Text1(2).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("sjxx_id")
Text1(1).Text = Adodc1.Recordset.Fields("sjxx_name")
Cbx_xb.Text = Adodc1.Recordset.Fields("sjxx_xb")
Cbx_lb.Text = Adodc1.Recordset.Fields("sjxx_jzlx")
DT1.Value = Adodc1.Recordset.Fields("sjxx_csrq")
Cbx_xl.Text = Adodc1.Recordset.Fields("sjxx_sjxl")
Text1(2).Text = Adodc1.Recordset.Fields("sjxx_sfzhm")
Text1(3).Text = Adodc1.Recordset.Fields("sjxx_jzhm")
Text1(12).Text = Adodc1.Recordset.Fields("sjxx_jylx")
DT2.Value = Adodc1.Recordset.Fields("sjxx_hzrq")
Text1(4).Text = Adodc1.Recordset.Fields("sjxx_yzbm")
Text1(5).Text = Adodc1.Recordset.Fields("sjxx_sfqk")
Text1(6).Text = Adodc1.Recordset.Fields("sjxx_jl")
Text1(7).Text = Adodc1.Recordset.Fields("sjxx_dh")
Text1(8).Text = Adodc1.Recordset.Fields("sjxx_xyqk")
Text1(9).Text = Adodc1.Recordset.Fields("sjxx_dzyj")
Text1(10).Text = Adodc1.Recordset.Fields("sjxx_sj")
Text1(11).Text = Adodc1.Recordset.Fields("sjxx_dz")
Text1(13).Text = Adodc1.Recordset.Fields("sjxx_bz")
End If
For i = 0 To 13
Text1(i).Locked = False
Next i
End Sub
Private Sub DT1_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then
Cbx_xl.SetFocus
End If
End Sub
Private Sub DT2_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then
Text1(4).SetFocus
End If
End Sub
Private Sub Form_Load()
Me.Left = (Screen.Width - Me.Width) / 2
Me.Top = (Screen.Height - Me.Height) / 2
Call LoadFile
For i = 1 To 13
Text1(i).Locked = True
Next i
Adodc1.ConnectionString = PublicStr
Adodc1.RecordSource = "select * from tb_Goods_sjxx order by sjxx_id"
Adodc1.Refresh
DT1.Value = Date
DT2.Value = Date
Call DBGCon
Call Tbr_cortrol(Tbr_xxcz, True)
End Sub
Private Sub Tbr_xxcz_ButtonClick(ByVal Button As MSComctlLib.Button)
Select Case Button.Index
Case 1
Call Tbr_cortrol(Tbr_xxcz, False)
For i = 1 To 13
Text1(i).Locked = False
Text1(i).Text = ""
Text1(1).SetFocus
Next i
AdoRs.Open "select * from tb_Goods_sjxx order by sjxx_id", Cnn, adOpenKeyset
If AdoRs.RecordCount > 0 Then
AdoRs.MoveLast
StrNum = Mid(AdoRs.Fields("sjxx_id"), 2, Len(AdoRs.Fields("sjxx_id")))
Call Con_PublicNum '调用位数转换函数
Text1(0).Text = "S" & StrIn
Else
Text1(0).Text = "S0001"
End If
AdoRs.Close
Case 2 '删除信息
Call Deletes
Call DBGCon
Case 3 '修改信息
Call Edits
Call DBGCon
Case 4 '保存信息
Call Saves
Call DBGCon
Case 5
Call Tbr_cortrol(Tbr_xxcz, True)
For i = 1 To 13
Text1(i).Text = ""
Text1(1).SetFocus
Text1(i).Locked = True
Next i
Adodc1.RecordSource = "select * from tb_Goods_sjxx order by sjxx_id"
Adodc1.Refresh
Call DBGCon
Case 6
ConBs = "Sjzl"
Frm_CommCx.Show 1
Case 7
Unload Me
End Select
End Sub
Private Sub Text1_KeyDown(Index As Integer, KeyCode As Integer, Shift As Integer)
On Error Resume Next
If Index = 0 Then
If KeyCode = 13 Then
Adodc1.RecordSource = "select * from tb_Goods_sjxx where sjxx_id='" + Text1(0).Text + "'"
Adodc1.Refresh
If Adodc1.Recordset.RecordCount > 0 Then
Text1(0).Text = Adodc1.Recordset.Fields("sjxx_id")
Text1(1).Text = Adodc1.Recordset.Fields("sjxx_name")
Cbx_xb.Text = Adodc1.Recordset.Fields("sjxx_xb")
Cbx_lb.Text = Adodc1.Recordset.Fields("sjxx_jzlx")
DT1.Value = Adodc1.Recordset.Fields("sjxx_csrq")
Cbx_xl.Text = Adodc1.Recordset.Fields("sjxx_sjxl")
Text1(2).Text = Adodc1.Recordset.Fields("sjxx_sfzhm")
Text1(3).Text = Adodc1.Recordset.Fields("sjxx_jzhm")
Text1(12).Text = Adodc1.Recordset.Fields("sjxx_jylx")
DT2.Value = Adodc1.Recordset.Fields("sjxx_hzrq")
Text1(4).Text = Adodc1.Recordset.Fields("sjxx_yzbm")
Text1(5).Text = Adodc1.Recordset.Fields("sjxx_sfqk")
Text1(6).Text = Adodc1.Recordset.Fields("sjxx_jl")
Text1(7).Text = Adodc1.Recordset.Fields("sjxx_dh")
Text1(8).Text = Adodc1.Recordset.Fields("sjxx_xyqk")
Text1(9).Text = Adodc1.Recordset.Fields("sjxx_dzyj")
Text1(10).Text = Adodc1.Recordset.Fields("sjxx_sj")
Text1(11).Text = Adodc1.Recordset.Fields("sjxx_dz")
Text1(13).Text = Adodc1.Recordset.Fields("sjxx_bz")
End If
For i = 0 To 13
Text1(i).Locked = False
Next i
End If
End If
Call DBGCon
If KeyCode = 13 Or KeyCode = 40 Then
If Index = 1 Then
Cbx_xb.SetFocus
Exit Sub
End If
If Index = 2 Then '限定身份证号
Set StrCodes = New PeopleCode
StrCodes.PeopleCode (Text1(2).Text)
DT1.Value = StrCodes.PeopleBirth
' Text3.Text = StrCodes.PeopleAge
Cbx_xb.Text = StrCodes.PeopleSex
Text1(2).Text = StrCodes.PeopleCodes
End If
If Index = 3 Then
DT2.SetFocus
Exit Sub
End If
If Index >= 0 Then Text1(Index + 1).SetFocus
End If
If Index = 4 Then
If KeyCode = 38 Then
DT2.SetFocus
Exit Sub
End If
End If
If Index = 2 Then
If KeyCode = 38 Then
Cbx_xl.SetFocus
Exit Sub
End If
End If
If Index >= 0 And KeyCode = 40 Then Text1(Index + 1).SetFocus
If Index <= 14 And KeyCode = 38 Then Text1(Index - 1).SetFocus
End Sub
Private Sub Saves() '保存信息的事件过程
If Text1(1).Text = "" Or Text1(5).Text = "" Then
MsgBox "重要信息不能为空值", 48, "提示信息"
Else
AdoRs.Open "select * from tb_Goods_sjxx where sjxx_name='" + Text1(1).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 tb_Goods_sjxx values('" & Text1(0) & "','" & Text1(1) & "','" & Cbx_xb & "','" & Cbx_lb & "','" & STR(DT1.Value) & "','" & Cbx_xl & "','" & Text1(3) & "','" & Text1(2) & "','" & Text1(12) & "','" _
& STR(DT2.Value) & "','" & Text1(4) & "','" & Text1(5) & "','" & Text1(6) & "','" & Text1(7) & "','" & Text1(8) & "','" & Text1(9) & "','" & Text1(10) & "','" & Text1(11) & "','" & Text1(13) & "')")
MsgBox "数据保存成功", 64, "提示信息"
Else
End If
Adodc1.RecordSource = "select * from tb_Goods_sjxx order by sjxx_id"
Adodc1.Refresh
Call DBGCon
End If
Call Tbr_cortrol(Tbr_xxcz, True)
End If
End Sub
Private Sub Edits() '修改信息的事件过程
On Error Resume Next
AdoRs.Open "select * from tb_Goods_clxx where clxx_sjxm='" + Text1(1) + "'", Cnn, adOpenKeyset
If AdoRs.RecordCount > 0 Then
MsgBox "该部门下有关联信息,不允许修改", 48, "提示信息"
Else
c = MsgBox("确认修改信息吗", 33, "提示信息")
If c = vbOK Then
Set AdoRs = Cnn.Execute("UPDATE tb_Goods_sjxx SET sjxx_id='" + Text1(0) + "',sjxx_name='" + Text1(1) + "',sjxx_xb='" + Cbx_xb + "',sjxx_jzlx='" + Cbx_lb + "',sjxx_csrq='" + STR(DT1.Value) + "',sjxx_sjxl='" _
+ Cbx_xl + "',sjxx_sfzhm='" + Text1(2) + "',sjxx_jzhm='" + Text1(3) + "',sjxx_hzrq='" + STR(DT2.Value) + "',sjxx_yzbm='" + Text1(4) + "',sjxx_sfqk='" + Text1(5) + "',sjxx_jl='" + Text1(6) + "',sjxx_dh='" _
+ Text1(7) + "',sjxx_xyqk='" + Text1(8) + "',sjxx_dzyj='" + Text1(9) + "',sjxx_sj='" + Text1(10) + "',sjxx_dz='" + Text1(11) + "',sjxx_jylx='" + Text1(12) + "',sjxx_bz='" + Text1(13) + "' where sjxx_id='" + Text1(0).Text + "'")
MsgBox "数据修改成功", 64, "提示信息"
Adodc1.RecordSource = "select * from tb_Goods_sjxx order by sjxx_id"
Adodc1.Refresh
StrId = Text1(0).Text
StrTitle = Text1(1).Text
Call joinRZ
Call DBGCon
Else
End If
End If
AdoRs.Close
End Sub
Private Sub LoadFile()
AdoRs.Open "select * from tb_Goods_sjxx", Cnn, adOpenKeyset
If AdoRs.RecordCount > 0 Then
Text1(0).Text = AdoRs.Fields("sjxx_id")
Text1(1).Text = AdoRs.Fields("sjxx_name")
Cbx_xb.Text = AdoRs.Fields("sjxx_xb")
Cbx_lb.Text = AdoRs.Fields("sjxx_jzlx")
DT1.Value = AdoRs.Fields("sjxx_csrq")
Cbx_xl.Text = AdoRs.Fields("sjxx_sjxl")
Text1(2).Text = AdoRs.Fields("sjxx_sfzhm")
Text1(3).Text = AdoRs.Fields("sjxx_jzhm")
Text1(12).Text = AdoRs.Fields("sjxx_jylx")
DT2.Value = AdoRs.Fields("sjxx_hzrq")
Text1(4).Text = AdoRs.Fields("sjxx_yzbm")
Text1(5).Text = AdoRs.Fields("sjxx_sfqk")
Text1(6).Text = AdoRs.Fields("sjxx_jl")
Text1(7).Text = AdoRs.Fields("sjxx_dh")
Text1(8).Text = AdoRs.Fields("sjxx_xyqk")
Text1(9).Text = AdoRs.Fields("sjxx_dzyj")
Text1(10).Text = AdoRs.Fields("sjxx_sj")
Text1(11).Text = AdoRs.Fields("sjxx_dz")
Text1(13).Text = AdoRs.Fields("sjxx_bz")
End If
AdoRs.Close
End Sub
Private Sub Deletes() '删除信息
AdoRs.Open "select * from tb_Goods_clxx where clxx_sjxm='" + Text1(1) + "'", Cnn, adOpenKeyset
If AdoRs.RecordCount > 0 Then
MsgBox "该部门下有关联信息,不允许删除", 48, "提示信息"
Else
c = MsgBox("确认删除该信息吗", 17, "提示信息")
If c = vbOK Then
On Error Resume Next
Set AdoRs = Cnn.Execute("Delete tb_Goods_sjxx from tb_Goods_sjxx where sjxx_id='" + Text1(0).Text + "'")
Adodc1.Refresh
End If
For i = 0 To 13
Text1(i).Text = ""
Next i
Cbx_xb.Text = ""
Cbx_lb.Text = ""
Cbx_xl.Text = ""
End If
AdoRs.Close
End Sub
Private Sub DBGCon()
Dgr_Sjll.Columns(0).Caption = "编号"
Dgr_Sjll.Columns(1).Caption = "司机姓名"
Dgr_Sjll.Columns(2).Caption = "性别"
Dgr_Sjll.Columns(3).Caption = "驾照类型"
Dgr_Sjll.Columns(4).Caption = "出生日期"
Dgr_Sjll.Columns(5).Caption = "学历"
Dgr_Sjll.Columns(6).Caption = "驾照号码"
Dgr_Sjll.Columns(7).Caption = "身份证号码"
Dgr_Sjll.Columns(8).Caption = "经营路线"
Dgr_Sjll.Columns(9).Caption = "合作日期"
Dgr_Sjll.Columns(10).Caption = "邮政编码"
Dgr_Sjll.Columns(11).Caption = "收费情况"
Dgr_Sjll.Columns(12).Caption = "司机驾龄"
Dgr_Sjll.Columns(13).Caption = "司机电话"
Dgr_Sjll.Columns(14).Caption = "信誉情况"
Dgr_Sjll.Columns(15).Caption = "电子邮件"
Dgr_Sjll.Columns(16).Caption = "司机手机"
Dgr_Sjll.Columns(17).Caption = "司机地址"
Dgr_Sjll.Columns(18).Caption = "备注"
End Sub
Private Sub Timer1_Timer()
On Error Resume Next
Lbl_Num.Caption = "当前数据表中共有 " & Adodc1.Recordset.RecordCount & " 条记录"
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -