📄 frm_ycgl.frm
字号:
Left = 210
TabIndex = 30
Top = 1290
Width = 840
End
Begin VB.Label Label5
Caption = "调度员"
Height = 315
Left = 210
TabIndex = 29
Top = 1665
Width = 930
End
Begin VB.Label Label9
Caption = "去向"
Height = 360
Left = 210
TabIndex = 28
Top = 3150
Width = 840
End
Begin VB.Label Label11
Caption = "车牌号码"
Height = 270
Left = 210
TabIndex = 27
Top = 4050
Width = 975
End
Begin VB.Line Line1
BorderColor = &H00008000&
Index = 1
X1 = 210
X2 = 8190
Y1 = 3870
Y2 = 3870
End
Begin VB.Line Line2
BorderColor = &H00008000&
Index = 1
X1 = 210
X2 = 8190
Y1 = 3900
Y2 = 3900
End
Begin VB.Label Label17
Caption = "日期"
Height = 255
Left = 210
TabIndex = 19
Top = 4860
Width = 810
End
Begin VB.Label Label16
Caption = "备注"
Height = 255
Left = 4740
TabIndex = 17
Top = 4485
Width = 615
End
Begin VB.Label Label15
Caption = "返回时间"
Height = 240
Left = 2490
TabIndex = 16
Top = 4485
Width = 750
End
Begin VB.Label Label14
Caption = "出车时间"
Height = 195
Left = 210
TabIndex = 15
Top = 4440
Width = 735
End
Begin VB.Label Label13
Caption = "司机姓名"
Height = 240
Left = 5955
TabIndex = 14
Top = 4110
Width = 720
End
Begin VB.Label Label12
Caption = "车辆类型"
Height = 285
Left = 3345
TabIndex = 12
Top = 4080
Width = 975
End
Begin VB.Label Label10
Caption = "领导签字"
Height = 225
Left = 210
TabIndex = 9
Top = 3540
Width = 735
End
Begin VB.Label Label8
Caption = "事由"
Height = 285
Left = 210
TabIndex = 8
Top = 2775
Width = 780
End
Begin VB.Label Label7
Caption = "人数"
Height = 270
Left = 210
TabIndex = 7
Top = 2385
Width = 840
End
Begin VB.Line Line2
BorderColor = &H00008000&
Index = 0
X1 = 240
X2 = 8175
Y1 = 5220
Y2 = 5220
End
Begin VB.Label Label6
Caption = "用车人"
Height = 270
Left = 210
TabIndex = 5
Top = 2010
Width = 885
End
Begin VB.Label Label3
Caption = "编号"
Height = 210
Left = 210
TabIndex = 4
Top = 960
Width = 585
End
Begin VB.Label Label2
Caption = "记录修改人"
Height = 255
Left = 6105
TabIndex = 2
Top = 5400
Width = 960
End
Begin VB.Label Label1
Caption = "记录修改日期"
Height = 225
Left = 3525
TabIndex = 0
Top = 5415
Width = 1140
End
Begin VB.Line Line1
BorderColor = &H00008000&
Index = 0
X1 = 240
X2 = 8175
Y1 = 5190
Y2 = 5190
End
End
Attribute VB_Name = "frm_ycgl"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim i As Integer
Dim c
Private Sub Cbx_lx_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then
Text1(9).SetFocus
End If
End Sub
Private Sub Cbx_ys_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then
Text1(6).SetFocus
End If
End Sub
Private Sub Cbx_xz_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then
Text1(11).SetFocus
End If
End Sub
Private Sub Command1_Click()
frm_T_Clxx.Left = 4900
frm_T_Clxx.Top = 5900
frm_T_Clxx.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(0)
Text1(1).Text = Adodc1.Recordset.Fields(1)
Text1(2).Text = Adodc1.Recordset.Fields(2)
Text1(3).Text = Adodc1.Recordset.Fields(3)
Text1(4).Text = Adodc1.Recordset.Fields(4)
Text1(5).Text = Adodc1.Recordset.Fields(5)
Text1(6).Text = Adodc1.Recordset.Fields(6)
Text1(7).Text = Adodc1.Recordset.Fields(7)
Text1(8).Text = Adodc1.Recordset.Fields(8)
Cbx_lx.Text = Adodc1.Recordset.Fields(9)
Text1(9).Text = Adodc1.Recordset.Fields(10)
DT1.Value = Adodc1.Recordset.Fields(11)
DT2.Value = Adodc1.Recordset.Fields(12)
Text1(10).Text = Adodc1.Recordset.Fields(13)
DT3.Value = Adodc1.Recordset.Fields(14)
Cbx_xz.Text = Adodc1.Recordset.Fields(15)
Text1(11).Text = Adodc1.Recordset.Fields(16)
Txt_Date.Text = Adodc1.Recordset.Fields(17)
Txt_lxr.Text = Adodc1.Recordset.Fields(18)
End If
End Sub
Private Sub DT1_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then
DT2.SetFocus
End If
End Sub
Private Sub DT2_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then
Text1(10).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
DT3.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 = Mid(AdoRs.Fields("编号"), 2, Len(AdoRs.Fields("编号")))
Call Con_PublicNum '调用位数转换函数
Text1(0).Text = "M" & StrIn
Else
Text1(0).Text = "M0001"
End If
AdoRs.Close
For i = 1 To 11
Text1(i).Text = ""
Text1(i).Locked = False
Next i
Cbx_lx.Text = ""
Cbx_xz.Text = ""
Text1(1).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 11
Text1(i).Text = ""
Text1(1).SetFocus
Text1(1).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
AdoRs.Open "select * from 车辆管理 where 编号='" + Text1(0) + "'", Cnn, adOpenKeyset
If AdoRs.RecordCount > 0 Then
Text1(0).Text = AdoRs.Fields(0)
Text1(1).Text = AdoRs.Fields(1)
Text1(2).Text = AdoRs.Fields(2)
Text1(3).Text = AdoRs.Fields(3)
Text1(4).Text = AdoRs.Fields(4)
Text1(5).Text = AdoRs.Fields(5)
Text1(6).Text = AdoRs.Fields(6)
Text1(7).Text = AdoRs.Fields(7)
Text1(8).Text = AdoRs.Fields(8)
Cbx_lx.Text = AdoRs.Fields(9)
Text1(9).Text = AdoRs.Fields(10)
DT1.Value = AdoRs.Fields(11)
DT2.Value = AdoRs.Fields(12)
Text1(10).Text = AdoRs.Fields(13)
DT3.Value = AdoRs.Fields(14)
Cbx_xz.Text = AdoRs.Fields(15)
Text1(11).Text = AdoRs.Fields(16)
Txt_Date.Text = AdoRs.Fields(17)
Txt_lxr.Text = AdoRs.Fields(18)
End If
AdoRs.Close
ElseIf Index = 8 Then
Call Command1_Click
Exit Sub
ElseIf Index = 9 Then
DT1.SetFocus
Exit Sub
ElseIf Index = 10 Then
DT3.SetFocus
Exit Sub
End If
End If
If KeyCode = 38 Then
If Index = 11 Then
Cbx_xz.SetFocus
Exit Sub
ElseIf Index = 10 Then
DT2.SetFocus
Exit Sub
ElseIf Index = 9 Then
Cbx_lx.SetFocus
Exit Sub
End If
End If
If Index < 12 And KeyCode = 38 Then Text1(Index - 1).SetFocus
If Index >= 0 And KeyCode = 13 Then Text1(Index + 1).SetFocus
If Index = 11 And KeyCode = 13 Then
Call Saves
End If
End Sub
Private Sub Saves() '保存信息的事件过程
If Text1(1).Text = "" Or Text1(5).Text = "" Or Text1(7).Text = "" Then
MsgBox "重要信息不能为空值", 48, "提示信息"
Else
If IsNumeric(Text1(4)) And IsNumeric(Text1(11)) Then
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('" & Text1(0) _
& "','" & Text1(1) & "','" & Text1(2) & "','" & Text1(3) & "','" & Text1(4) & "','" & Text1(5) & "','" & Text1(6) & "','" _
& Text1(7) & "','" & Text1(8) & "','" & Cbx_lx & "','" & Text1(9) & "','" & STR(DT1.Value) & "','" & STR(DT2.Value) & "','" _
& Text1(10) & "','" & STR(DT3.Value) & "','" & Cbx_xz & "','" & Text1(11) & "',' ',' ')")
MsgBox "数据保存成功", 64, "提示信息"
Adodc1.RecordSource = "select * from 车辆管理 order by 编号"
Adodc1.Refresh
Else
End If
End If
Call Tbr_cortrol(Tbr_xxcz, True)
Else
MsgBox "输入的人数或金额数值非法", 48, "提示信息"
End If
End If
End Sub
Private Sub Edits() '修改信息的事件过程
c = MsgBox("确认修改信息吗?", 33, "提示信息")
If c = vbOK Then
Set AdoRs = Cnn.Execute("UPDATE 车辆管理 SET 编号='" + Text1(0) + "',值班员='" + Text1(1) + "',调度员='" + Text1(2) + "',用车人='" _
+ Text1(3) + "',人数='" + Text1(4) + "',事由='" + Text1(5) + "',去向='" + Text1(6) + "',签字领导='" + Text1(7) + "',车牌号码='" + Text1(8) + "',车类型='" + Cbx_lx + "',司机姓名='" + Text1(9) _
+ "',出车时间='" + STR(DT1.Value) + "',返回时间='" + STR(DT2.Value) + "',备注='" + Text1(10) + "',日期='" + STR(DT3.Value) + "',用车性质='" + Cbx_xz + "',费用='" + Text1(11) + "',记录修改日期='" + STR(Date) + "',记录修改人='" + Name1 + "' where 编号='" + Text1(0).Text + "'")
MsgBox "数据修改成功", 64, "提示信息"
Adodc1.RecordSource = "select * from 车辆管理 order by 编号"
Adodc1.Refresh
StrId = Text1(0).Text
StrTitle = Text1(8).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(0)
Text1(1).Text = AdoRs.Fields(1)
Text1(2).Text = AdoRs.Fields(2)
Text1(3).Text = AdoRs.Fields(3)
Text1(4).Text = AdoRs.Fields(4)
Text1(5).Text = AdoRs.Fields(5)
Text1(6).Text = AdoRs.Fields(6)
Text1(7).Text = AdoRs.Fields(7)
Text1(8).Text = AdoRs.Fields(8)
Cbx_lx.Text = AdoRs.Fields(9)
Text1(9).Text = AdoRs.Fields(10)
DT1.Value = AdoRs.Fields(11)
DT2.Value = AdoRs.Fields(12)
Text1(10).Text = AdoRs.Fields(13)
DT3.Value = AdoRs.Fields(14)
Cbx_xz.Text = AdoRs.Fields(15)
Text1(11).Text = AdoRs.Fields(16)
Txt_Date.Text = AdoRs.Fields(17)
Txt_lxr.Text = AdoRs.Fields(18)
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 11
Text1(i).Text = ""
Next i
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -