📄 frm_clxx.frm
字号:
Top = 315
Width = 765
End
Begin VB.Label Label1
Caption = "车牌号码"
Height = 255
Index = 1
Left = 2715
TabIndex = 4
Top = 330
Width = 855
End
Begin VB.Label Label1
Caption = "编号"
Height = 255
Index = 0
Left = 120
TabIndex = 2
Top = 315
Width = 855
End
End
Begin MSDataGridLib.DataGrid Dgr_Sjll
Bindings = "Frm_Clxx.frx":9C99
Height = 2685
Left = 45
TabIndex = 15
Top = 3000
Width = 7530
_ExtentX = 13282
_ExtentY = 4736
_Version = 393216
AllowUpdate = 0 'False
AllowArrows = 0 'False
HeadLines = 1
RowHeight = 15
BeginProperty HeadFont {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ColumnCount = 2
BeginProperty Column00
DataField = ""
Caption = ""
BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED}
Type = 0
Format = ""
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 2052
SubFormatType = 0
EndProperty
EndProperty
BeginProperty Column01
DataField = ""
Caption = ""
BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED}
Type = 0
Format = ""
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 2052
SubFormatType = 0
EndProperty
EndProperty
SplitCount = 1
BeginProperty Split0
BeginProperty Column00
EndProperty
BeginProperty Column01
EndProperty
EndProperty
End
Begin VB.Label Lbl_Num
Caption = "Label6"
Height = 210
Left = 60
TabIndex = 16
Top = 5745
Width = 3495
End
End
Attribute VB_Name = "Frm_Clxx"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim i As Integer
Dim c '判断MsgBox函数执行哪个按钮的变量
Public StrCodes As PeopleCode
Private Sub Cbx_lx_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then
Text1(2).SetFocus
End If
End Sub
Private Sub Cmd_Select_Click()
frm_T_Sjxx.Left = 4600
frm_T_Sjxx.Top = 3250
frm_T_Sjxx.Show 1
End Sub
Private Sub Dgr_Sjll_Click()
On Error Resume Next
If Adodc1.Recordset.RecordCount > 0 Then
Text1(0).Text = Adodc1.Recordset.Fields("clxx_id")
Text1(1).Text = Adodc1.Recordset.Fields("clxx_cphm")
Cbx_lx.Text = Adodc1.Recordset.Fields("clxx_cllx")
Text1(2).Text = Adodc1.Recordset.Fields("clxx_sjxm")
DT2.Value = Adodc1.Recordset.Fields("clxx_csrq")
Text1(3).Text = Adodc1.Recordset.Fields("clxx_czxm")
Text1(4).Text = Adodc1.Recordset.Fields("clxx_sfzhm")
Text1(5).Text = Adodc1.Recordset.Fields("clxx_dzyj")
Text1(6).Text = Adodc1.Recordset.Fields("clxx_czdh")
Text1(7).Text = Adodc1.Recordset.Fields("clxx_czsj")
Text1(8).Text = Adodc1.Recordset.Fields("clxx_sjsj")
Text1(9).Text = Adodc1.Recordset.Fields("clxx_yzbm")
Text1(10).Text = Adodc1.Recordset.Fields("clxx_dz")
Text1(11).Text = Adodc1.Recordset.Fields("clxx_bz")
End If
For i = 0 To 11
Text1(i).Locked = False
Next i
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 11 '锁定文本框,禁止输入字符信息
Text1(i).Locked = True
Next i
Adodc1.ConnectionString = PublicStr
Adodc1.RecordSource = "select * from tb_Goods_clxx order by clxx_id"
Adodc1.Refresh
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 11
Text1(i).Locked = False
Text1(i).Text = ""
Text1(1).SetFocus
Next i
AdoRs.Open "select * from tb_Goods_clxx order by clxx_id", Cnn, adOpenKeyset
If AdoRs.RecordCount > 0 Then
AdoRs.MoveLast
StrNum = Mid(AdoRs.Fields("clxx_id"), 2, Len(AdoRs.Fields("clxx_id")))
Call Con_PublicNum '调用位数转换函数
Text1(0).Text = "C" & StrIn
Else
Text1(0).Text = "C0001"
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 11
Text1(i).Text = ""
Text1(1).SetFocus
Next i
Adodc1.RecordSource = "select * from tb_Goods_clxx order by clxx_id"
Adodc1.Refresh
Call DBGCon
Case 6
ConBs = "Clzl"
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_clxx where clxx_id='" + Text1(0).Text + "'"
Adodc1.Refresh
If Adodc1.Recordset.RecordCount > 0 Then
Text1(0).Text = Adodc1.Recordset.Fields("clxx_id")
Text1(1).Text = Adodc1.Recordset.Fields("clxx_cphm")
Cbx_lx.Text = Adodc1.Recordset.Fields("clxx_cllx")
Text1(2).Text = Adodc1.Recordset.Fields("clxx_sjxm")
DT2.Value = Adodc1.Recordset.Fields("clxx_csrq")
Text1(3).Text = Adodc1.Recordset.Fields("clxx_czxm")
Text1(4).Text = Adodc1.Recordset.Fields("clxx_sfzhm")
Text1(5).Text = Adodc1.Recordset.Fields("clxx_dzyj")
Text1(6).Text = Adodc1.Recordset.Fields("clxx_czdh")
Text1(7).Text = Adodc1.Recordset.Fields("clxx_czsj")
Text1(8).Text = Adodc1.Recordset.Fields("clxx_sjsj")
Text1(9).Text = Adodc1.Recordset.Fields("clxx_yzbm")
Text1(10).Text = Adodc1.Recordset.Fields("clxx_dz")
Text1(11).Text = Adodc1.Recordset.Fields("clxx_bz")
End If
For i = 1 To 11
Text1(i).Locked = False
Next i
End If
End If
Call DBGCon
If KeyCode = 13 Or KeyCode = 40 Then
If Index = 1 Then
Cbx_lx.SetFocus
Exit Sub
End If
If Index = 2 Then
If KeyCode = 13 Then
Call Cmd_Select_Click
End If
Exit Sub
End If
If Index = 4 Then '限定身份证号
Set StrCodes = New PeopleCode
StrCodes.PeopleCode (Text1(4).Text)
DT2.Value = StrCodes.PeopleBirth
Text1(4).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_lx.SetFocus
Exit Sub
End If
End If
If Index = 11 Then
If KeyCode = 13 Then
Call Saves
End If
End If
If Index >= 0 And KeyCode = 40 Then Text1(Index + 1).SetFocus
If Index <= 11 And KeyCode = 38 Then Text1(Index - 1).SetFocus
End Sub
Private Sub Saves() '保存信息的事件过程
If Text1(1).Text = "" Or Text1(3).Text = "" Then
MsgBox "重要信息不能为空值", 48, "提示信息"
Else
AdoRs.Open "select * from tb_Goods_clxx where clxx_cphm='" + 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_clxx values('" & Text1(0) & "','" & Text1(1) & "','" & Cbx_lx & "','" & Text1(2) & "','" & Text1(3) & "','" _
& Text1(6) & "','" & Text1(4) & "','" & Text1(5) & "','" & Text1(8) & "','" & Text1(7) & "','" & STR(DT2.Value) & "','" & Text1(9) & "','" & Text1(10) & "','" & Text1(11) & "')")
MsgBox "数据保存成功", 64, "提示信息"
Else
End If
Adodc1.RecordSource = "select * from tb_Goods_clxx order by clxx_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_cldd where cldd_cphm='" + 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_clxx SET clxx_id='" + Text1(0) + "',clxx_cphm='" + Text1(1) + "',clxx_cllx='" + Cbx_lx + "',clxx_sjxm='" + Text1(2) + "',clxx_csrq='" + STR(DT2.Value) + "',clxx_czxm='" _
+ Text1(3) + "',clxx_sfzhm='" + Text1(4) + "',clxx_dzyj='" + Text1(5) + "',clxx_czdh='" + Text1(6) + "',clxx_czsj='" + Text1(7) + "',clxx_sjsj='" + Text1(8) + "',clxx_yzbm='" + Text1(9) + "',clxx_dz='" _
+ Text1(10) + "',clxx_bz='" + Text1(11) + "' where clxx_id='" + Text1(0).Text + "'")
MsgBox "数据修改成功", 64, "提示信息"
Adodc1.RecordSource = "select * from tb_Goods_clxx order by clxx_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_clxx", Cnn, adOpenKeyset
If AdoRs.RecordCount > 0 Then
Text1(0).Text = AdoRs.Fields("clxx_id")
Text1(1).Text = AdoRs.Fields("clxx_cphm")
Cbx_lx.Text = AdoRs.Fields("clxx_cllx")
Text1(2).Text = AdoRs.Fields("clxx_sjxm")
DT2.Value = AdoRs.Fields("clxx_csrq")
Text1(3).Text = AdoRs.Fields("clxx_czxm")
Text1(4).Text = AdoRs.Fields("clxx_sfzhm")
Text1(5).Text = AdoRs.Fields("clxx_dzyj")
Text1(6).Text = AdoRs.Fields("clxx_czdh")
Text1(7).Text = AdoRs.Fields("clxx_czsj")
Text1(8).Text = AdoRs.Fields("clxx_sjsj")
Text1(9).Text = AdoRs.Fields("clxx_yzbm")
Text1(10).Text = AdoRs.Fields("clxx_dz")
Text1(11).Text = AdoRs.Fields("clxx_bz")
End If
AdoRs.Close
End Sub
Private Sub Deletes() '删除信息
AdoRs.Open "select * from tb_Goods_cldd where cldd_cphm='" + 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_clxx from tb_Goods_clxx where clxx_id='" + Text1(0).Text + "'")
Adodc1.Refresh
End If
For i = 1 To 15
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 = "备注信息"
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 + -