📄 frmcarsglr.frm
字号:
Index = 3
Left = 1155
TabIndex = 24
Top = 1380
Width = 255
End
Begin VB.Label Label5
Caption = "*"
ForeColor = &H000000FF&
Height = 135
Index = 4
Left = 1155
TabIndex = 23
Top = 1740
Width = 255
End
Begin VB.Label Label5
Caption = "*"
ForeColor = &H000000FF&
Height = 135
Index = 5
Left = 1155
TabIndex = 22
Top = 2100
Width = 255
End
Begin VB.Label Label5
Caption = "*"
ForeColor = &H000000FF&
Height = 135
Index = 6
Left = 4140
TabIndex = 21
Top = 1410
Width = 255
End
End
Begin VB.CommandButton cmdExit
Caption = " 退 出(&E)"
Height = 330
Left = 9015
TabIndex = 0
Top = 2610
Width = 1095
End
Begin MSAdodcLib.Adodc Adodc1
Height = 330
Left = 3315
Top = 2610
Width = 3540
_ExtentX = 6244
_ExtentY = 582
ConnectMode = 0
CursorLocation = 3
IsolationLevel = -1
ConnectionTimeout= 15
CommandTimeout = 30
CursorType = 3
LockType = 3
CommandType = 1
CursorOptions = 0
CacheSize = 50
MaxRecords = 0
BOFAction = 0
EOFAction = 0
ConnectStringType= 1
Appearance = 1
BackColor = 12632256
ForeColor = -2147483640
Orientation = 0
Enabled = -1
Connect = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=clgl.mdb;Persist Security Info=False"
OLEDBString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=clgl.mdb;Persist Security Info=False"
OLEDBFile = ""
DataSourceName = ""
OtherAttributes = ""
UserName = ""
Password = ""
RecordSource = "select * from 车辆事故表"
Caption = " 浏览事故记录"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
_Version = 393216
End
Begin VB.CommandButton cmdDelete
Caption = "删 除(&D)"
Height = 330
Left = 2235
TabIndex = 1
Top = 2610
Width = 1095
End
Begin VB.CommandButton cmdUpdate
Caption = "修 改(&U)"
Height = 330
Left = 1155
TabIndex = 2
Top = 2610
Width = 1095
End
Begin VB.CommandButton cmdCancel
Caption = "取 消(&Q)"
Enabled = 0 'False
Height = 330
Left = 7935
TabIndex = 3
Top = 2610
Width = 1095
End
Begin VB.CommandButton cmdok
Caption = "确 定(&O)"
Enabled = 0 'False
Height = 330
Left = 6855
TabIndex = 5
Top = 2610
Width = 1095
End
Begin VB.CommandButton cmdAdd
Caption = "添 加(&A)"
Height = 330
Left = 75
TabIndex = 4
Top = 2610
Width = 1095
End
End
Attribute VB_Name = "frmcarSGlr"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim i As Integer
Private Sub cmdAdd_Click()
Unlockctl
Text1 = "": Text2 = "": Text3 = "": Text5 = ""
Text6 = "": Text7 = "": Text8 = "": Text9 = ""
Text10 = "": Text11 = "": Text12 = "": Text13 = ""
Text14 = "": Text3 = "": Text1.SetFocus
cmdOk.Enabled = True: cmdCancel.Enabled = True
cmdUpdate.Enabled = False: cmdDelete.Enabled = False
DTPicker1.Visible = True
TextDTP.Visible = False: Adodc1.Enabled = False
i = 1
End Sub
Private Sub cmdCancel_Click()
On Error Resume Next '当没有添加数据的时候 处理异常
Adodc1.Recordset.CancelUpdate
Adodc1.Refresh
Lockctl
cmdOk.Enabled = False: cmdCancel.Enabled = False
cmdAdd.Enabled = True: cmdUpdate.Enabled = True
cmdDelete.Enabled = True: DTPicker1.Visible = False
TextDTP.Visible = True: Adodc1.Enabled = True
End Sub
Private Sub cmdDelete_Click()
If MsgBox("您确实要删除记录吗?", vbOKCancel, "系统提示") = vbOK Then
adoCon.Execute ("delete from 车辆事故表 where 事故编号='" & Text1 & "'")
MsgBox " 记录已删除!", , "系统提示"
Adodc1.Refresh
End If
End Sub
Private Sub cmdExit_Click()
MDIForm1.StatusBar1.Panels(1).Text = ""
Unload Me
End Sub
Private Sub cmdOk_Click()
Select Case i
Case 1:
If Text1.Text = "" Then
MsgBox "事故编号不能为空!", , "系统提示"
Exit Sub
End If
If Text2.Text = "" Then
MsgBox "车牌号码不能为空!", , "系统提示"
Text2.SetFocus: Exit Sub
End If
If Text5.Text = "" Then
MsgBox "事故概要不能为空!", , "系统提示"
Text5.SetFocus: Exit Sub
End If
If Text6.Text = "" Then
MsgBox "事故确认者不能为空!!", , "系统提示"
Text6.SetFocus: Exit Sub
End If
If Text10 = "" Then
MsgBox "对方姓名不能为空!!", , "系统提示"
Text10.SetFocus: Exit Sub
End If
adoCon.Execute ("insert into 车辆事故表 values ('" & Text1 & "','" & Text2 & "','" & Text3.Text & "','" & DTPicker1.Value & "','" & Text5 & "','" & Text6 & "','" & Text7 & "','" & Text8 & "','" & Text9 & "','" & Text10 & "','" & Text11 & "','" & Text12 & "','" & Text13 & "','" & Text14 & "')")
MsgBox "记录添加成功!", , "系统提示"
Adodc1.Refresh
Case 2
adoCon.Execute ("update 车辆事故表 set 车牌号码='" & Text2.Text & "',车辆类型='" & Text3.Text & "',事故时间='" & DTPicker1.Value & "',事故概要='" & Text5.Text & "',事故确认者='" & Text6.Text & "',公司负担金='" & Text7.Text & "',保险理赔金='" & Text8.Text & "',对方赔偿金='" & Text9.Text & "',对方姓名='" & Text10.Text & "',对方住址='" & Text11.Text & "',对方所在单位='" & Text12.Text & "',对方损坏程度='" & Text13.Text & "',和解内容='" & Text14.Text & "' where 事故编号='" & Text1.Text & "'")
MsgBox "记录修改成功!", , "系统提示"
Adodc1.Refresh
End Select
Lockctl
cmdOk.Enabled = False: cmdCancel.Enabled = False
cmdAdd.Enabled = True: cmdUpdate.Enabled = True
cmdDelete.Enabled = True: DTPicker1.Visible = False
TextDTP.Visible = True: Adodc1.Enabled = True
End Sub
Private Sub cmdUpdate_Click()
Unlockctl
cmdOk.Enabled = True: cmdCancel.Enabled = True
cmdAdd.Enabled = False: cmdDelete.Enabled = False
DTPicker1.Visible = True: TextDTP.Visible = False
Adodc1.Enabled = False: Text1.Enabled = False
i = 2
End Sub
Private Sub text3_KeyPress(KeyAscii As Integer)
KeyAscii = valiText(KeyAscii, Chr(13), True)
If KeyAscii = 13 Then
DTPicker1.SetFocus
End If
End Sub
Private Sub Form_Load()
frmcarSGlr.Width = 10350: frmcarSGlr.Height = 3435
' Adodc2.RecordSource = "select * from 车辆类型表"
' Adodc2.Refresh
' For i = 0 To Adodc2.Recordset.RecordCount - 1
' Text.AddItem Adodc2.Recordset.Fields(0).Value
' Adodc2.Recordset.MoveNext
' Next
' Combo1.Text = Adodc1.Recordset.Fields(2)
End Sub
Private Sub Lockctl()
Text1.Enabled = False: Text2.Enabled = False
Text3.Enabled = False: Text5.Enabled = False
Text6.Enabled = False: Text7.Enabled = False
Text8.Enabled = False: Text9.Enabled = False
Text10.Enabled = False: Text11.Enabled = False
Text12.Enabled = False: Text13.Enabled = False
Text14.Enabled = False: DTPicker1.Enabled = False: TextDTP.Enabled = False
End Sub
Private Sub Unlockctl()
Text1.Enabled = True: Text2.Enabled = True
Text3.Enabled = True: Text5.Enabled = True
Text6.Enabled = True: Text7.Enabled = True
Text8.Enabled = True: Text9.Enabled = True
Text10.Enabled = True: Text11.Enabled = True
Text12.Enabled = True: Text13.Enabled = True
Text14.Enabled = True: DTPicker1.Enabled = True: TextDTP.Enabled = True
End Sub
Private Sub Text1_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyReturn Then
If Text1.Text = "" Then
MsgBox "不能为空,格式为日期“20040508”是有效格式!", , "系统提示"
Exit Sub
End If
Text2.SetFocus
End If
End Sub
Private Sub Text1_KeyPress(KeyAscii As Integer)
KeyAscii = valiText(KeyAscii, Chr(8) & "0123456789" & Chr(13), True)
End Sub
Private Sub Text2_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyReturn Then
If Text2.Text = "" Then
MsgBox "车牌号码不能为空!", , "系统提示"
Text2.SetFocus
Exit Sub
End If
Text3.SetFocus
End If
End Sub
Private Sub DTPicker1_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyReturn Then Text5.SetFocus
End Sub
Private Sub Text2_LostFocus()
If Text2.Text = "" Then Exit Sub
Dim rss As New ADODB.Recordset
Set rss = adoCon.Execute("select * from 车辆档案 where 车牌号码='" & Text2.Text & "'")
If rss.EOF Then
MsgBox "这辆车不属于本公司的!", , "系统提示"
Text2.Text = ""
Text2.SetFocus
Exit Sub
Else
Text3.Text = rss.Fields(1).Value
End If
rss.Close
Dim rss1 As New ADODB.Recordset
Set rss1 = adoCon.Execute("select * from 车辆异动表 where 车牌号码='" & Text2.Text & "'")
If rss1.EOF = False Then
MsgBox "这辆车为异动车辆!", , "系统提示"
Text2.Text = ""
Text2.SetFocus
Exit Sub
End If
rss1.Close
End Sub
Private Sub Text5_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyReturn Then
If Text5.Text = "" Then
MsgBox "事故概要不能为空!", , "系统提示"
Text5.SetFocus
Exit Sub
End If
Text6.SetFocus
End If
End Sub
Private Sub Text6_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyReturn Then
If Text6.Text = "" Then
MsgBox "事故确认者不能为空!!", , "系统提示"
Text6.SetFocus
Exit Sub
End If
Text7.SetFocus
End If
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 Text9.SetFocus
End Sub
Private Sub Text9_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyReturn Then Text10.SetFocus
End Sub
Private Sub Text10_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyReturn Then
If Text10 = "" Then
MsgBox "对方姓名不能为空!!", , "系统提示"
Text10.SetFocus
Exit Sub
End If
Text11.SetFocus
End If
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 Text13.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 cmdOk.SetFocus
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -