📄 frm_cltb.frm
字号:
EndProperty
BeginProperty Button10 {66833FEA-8583-11D1-B16A-00C0F0283628}
Style = 3
EndProperty
BeginProperty Button11 {66833FEA-8583-11D1-B16A-00C0F0283628}
Caption = "退出"
Key = "Exit"
ImageIndex = 6
EndProperty
BeginProperty Button12 {66833FEA-8583-11D1-B16A-00C0F0283628}
Style = 3
EndProperty
EndProperty
BorderStyle = 1
End
Begin VB.Label Label12
Caption = "按车牌号码查询"
Height = 240
Left = 240
TabIndex = 23
Top = 4470
Width = 1350
End
Begin VB.Label Label4
Caption = "保险公司"
Height = 240
Left = 210
TabIndex = 21
Top = 1290
Width = 840
End
Begin VB.Label Label5
Caption = "保单号"
Height = 315
Left = 210
TabIndex = 20
Top = 1665
Width = 930
End
Begin VB.Label Label9
Caption = "终止日期"
Height = 360
Left = 210
TabIndex = 19
Top = 3150
Width = 840
End
Begin VB.Label Label11
Caption = "备注信息"
Height = 270
Left = 210
TabIndex = 18
Top = 3915
Width = 975
End
Begin VB.Line Line1
BorderColor = &H00008000&
Index = 1
X1 = 210
X2 = 8190
Y1 = 4245
Y2 = 4245
End
Begin VB.Line Line2
BorderColor = &H00008000&
Index = 1
X1 = 210
X2 = 8190
Y1 = 4275
Y2 = 4275
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 = "车险名称2"
Height = 270
Left = 210
TabIndex = 7
Top = 2385
Width = 840
End
Begin VB.Label Label6
Caption = "车险名称1"
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 = 825
End
Begin VB.Label Label2
Caption = "记录修改人"
Height = 255
Left = 6135
TabIndex = 2
Top = 4455
Width = 960
End
Begin VB.Label Label1
Caption = "记录修改日期"
Height = 225
Left = 3555
TabIndex = 0
Top = 4470
Width = 1140
End
End
Attribute VB_Name = "frm_cltb"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim i As Integer
Dim c
Private Sub Command1_Click()
frm_T_Cltb.Left = 4900
frm_T_Cltb.Top = 3200
frm_T_Cltb.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)
DT1.Value = Adodc1.Recordset.Fields(5)
DT2.Value = Adodc1.Recordset.Fields(6)
Text1(5).Text = Adodc1.Recordset.Fields(7)
Text1(6).Text = Adodc1.Recordset.Fields(8)
Txt_Date.Text = Adodc1.Recordset.Fields(9)
Txt_xgr.Text = Adodc1.Recordset.Fields(10)
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(5).SetFocus
End If
End Sub
Private Sub Form_Load()
Call LoadFile
DT1.Value = Date
DT2.Value = Date
Adodc1.ConnectionString = PublicStr
Adodc1.RecordSource = "select * from 车辆投保信息 order by 车牌号码"
Adodc1.Refresh
Call Tbr_cortrol(Tbr_xxcz, True)
End Sub
Private Sub Label18_Click()
End Sub
Private Sub Tbr_xxcz_ButtonClick(ByVal Button As MSComctlLib.Button)
Select Case Button.Key
Case "Add"
Call Tbr_cortrol(Tbr_xxcz, False)
For i = 0 To 6
Text1(i).Text = ""
Text1(i).Locked = False
Next i
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 = 0 To 6
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
Call Command1_Click
Exit Sub
ElseIf Index = 4 Then
DT1.SetFocus
Exit Sub
End If
End If
If KeyCode = 38 Then
If Index = 5 Then
DT2.SetFocus
Exit Sub
End If
End If
If Index < 7 And KeyCode = 38 Then Text1(Index - 1).SetFocus
If Index >= 0 And KeyCode = 13 Then Text1(Index + 1).SetFocus
If Index = 6 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
If IsNumeric(Text1(5).Text) 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) & "','" & STR(DT1.Value) & "','" & STR(DT2.Value) & "','" _
& Text1(5) & "','" & Text1(6) & "',' ',' ')")
MsgBox "数据保存成功", 64, "提示信息"
Adodc1.RecordSource = "select * from 车辆投保信息 order by 车牌号码"
Adodc1.Refresh
Else
End If
End If
Call Tbr_cortrol(Tbr_xxcz, True)
Else
MsgBox "输入的保险金额数值非法", 48, "提示信息"
Text1(5).Text = ""
Text1(5).SetFocus
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) + "',投保日期='" + STR(DT1.Value) + "',终止日期='" + STR(DT2.Value) + "',保险金额='" + Text1(5) + "',备注='" _
+ Text1(6) + "',记录修改日期='" + 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(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)
DT1.Value = AdoRs.Fields(5)
DT2.Value = AdoRs.Fields(6)
Text1(5).Text = AdoRs.Fields(7)
Text1(6).Text = AdoRs.Fields(8)
Txt_Date.Text = AdoRs.Fields(9)
Txt_xgr.Text = AdoRs.Fields(10)
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 6
Text1(i).Text = ""
Next i
End Sub
Private Sub Txt_Cx_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then
AdoRs.Open "select * from 车辆投保信息 where 车牌号码='" + Txt_Cx + "'", 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)
DT1.Value = AdoRs.Fields(5)
DT2.Value = AdoRs.Fields(6)
Text1(5).Text = AdoRs.Fields(7)
Text1(6).Text = AdoRs.Fields(8)
Txt_Date.Text = AdoRs.Fields(9)
Txt_xgr.Text = AdoRs.Fields(10)
End If
AdoRs.Close
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -