⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 frmcarsglr.frm

📁 用VB开发的车辆数据库管理系统
💻 FRM
📖 第 1 页 / 共 2 页
字号:
      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.Image Image1 
      Height          =   330
      Index           =   3
      Left            =   3210
      Picture         =   "frmcarSGlr.frx":1C7A
      Stretch         =   -1  'True
      Top             =   2730
      Width           =   945
   End
   Begin VB.Image Image1 
      Height          =   330
      Index           =   2
      Left            =   2265
      Picture         =   "frmcarSGlr.frx":5AB4
      Stretch         =   -1  'True
      Top             =   2730
      Width           =   945
   End
   Begin VB.Image Image1 
      Height          =   330
      Index           =   1
      Left            =   1320
      Picture         =   "frmcarSGlr.frx":97CA
      Stretch         =   -1  'True
      Top             =   2730
      Width           =   945
   End
   Begin VB.Image Image1 
      Height          =   330
      Index           =   0
      Left            =   390
      Picture         =   "frmcarSGlr.frx":D4B1
      Stretch         =   -1  'True
      Top             =   2730
      Width           =   945
   End
   Begin VB.Image Imgexit 
      Height          =   330
      Left            =   8880
      Picture         =   "frmcarSGlr.frx":112CB
      Stretch         =   -1  'True
      Top             =   2730
      Width           =   945
   End
   Begin VB.Image Imgcancel 
      Height          =   330
      Left            =   7935
      Picture         =   "frmcarSGlr.frx":1529D
      Stretch         =   -1  'True
      Top             =   2730
      Width           =   945
   End
   Begin VB.Image Imgok 
      Height          =   330
      Left            =   6990
      Picture         =   "frmcarSGlr.frx":192AF
      Stretch         =   -1  'True
      Top             =   2730
      Width           =   945
   End
   Begin VB.Image Imgdelete 
      Height          =   330
      Left            =   6045
      Picture         =   "frmcarSGlr.frx":1D2BC
      Stretch         =   -1  'True
      Top             =   2730
      Width           =   945
   End
   Begin VB.Image Imgupdate 
      Height          =   330
      Left            =   5100
      Picture         =   "frmcarSGlr.frx":212CB
      Stretch         =   -1  'True
      Top             =   2730
      Width           =   945
   End
   Begin VB.Image Imgadd 
      Height          =   330
      Left            =   4155
      Picture         =   "frmcarSGlr.frx":252E6
      Stretch         =   -1  'True
      Top             =   2730
      Width           =   945
   End
End
Attribute VB_Name = "frmcarSGlr"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'*************************************************************************
'**模 块 名:frmcarSGlr
'**版权说明:吉林省明日科技有限公司享有本软件的所有版权,如果本软件用于商
'**          业用途,必须经过吉林省明日科技有限公司授权。如果提供网上免费
'**          下载,必须经过吉林省明日科技有限公司授权,并保证程序的完整,
'**          不得修改代码、注释和相关内容,否则,我公司将追究其法律责任
'**网    址:www.mingrisoft.com  价值无限,服务无限
'**电    话:(0431)84978981,84978982
'**创 建 人:明日科技
'**日    期:2007-10-31
'**修 改 人:mraj
'**日    期:2007-10-31
'**描    述:
'*************************************************************************
Dim i As Integer
Private Sub Image1_Click(Index As Integer)   '浏览记录
On Error Resume Next
  Select Case Index
         Case 0   '首记录
         Adodc1.Recordset.MoveFirst
         Case 1   '上一条记录
         If Adodc1.Recordset.BOF = False Then
            Adodc1.Recordset.MovePrevious
         Else
            MsgBox "向前已经没有记录了!", , "车辆管理系统"
         End If
         Case 2   '下一条
         If Adodc1.Recordset.EOF = False Then
            Adodc1.Recordset.MoveNext
         Else
            MsgBox "向后已经没有记录了!", , "车辆管理系统"
         End If
         Case 3   '尾记录
         Adodc1.Recordset.MoveLast
  End Select
  Text1.Text = Adodc1.Recordset.Fields("事故编号")
  Text2.Text = Adodc1.Recordset.Fields("车牌号码")
  Text3.Text = Adodc1.Recordset.Fields("车辆类型")
  TextDTP.Text = Adodc1.Recordset.Fields("事故时间")
  Text5.Text = Adodc1.Recordset.Fields("事故概要")
  Text6.Text = Adodc1.Recordset.Fields("事故确认者")
  Text7.Text = Adodc1.Recordset.Fields("公司负担金")
  Text8.Text = Adodc1.Recordset.Fields("保险理赔金")
  Text9.Text = Adodc1.Recordset.Fields("对方赔偿金")
  Text10.Text = Adodc1.Recordset.Fields("对方姓名")
  Text11.Text = Adodc1.Recordset.Fields("对方住址")
  Text12.Text = Adodc1.Recordset.Fields("对方所在单位")
  Text13.Text = Adodc1.Recordset.Fields("对方损坏程度")
  Text14.Text = Adodc1.Recordset.Fields("和解内容")

End Sub

Private Sub Imgadd_Click()  '增加
Unlockctl
    Text1 = "": Text2 = "": Text3 = "": Text5 = ""
    Text6 = "": Text7 = "": Text8 = "": Text9 = ""
    Text10 = "": Text11 = "": Text12 = "": Text13 = ""
    Text14 = "": Text3 = "": Text1.SetFocus
    Imgok.Enabled = True: Imgcancel.Enabled = True
    Imgupdate.Enabled = False: Imgdelete.Enabled = False
    DTPicker1.Visible = True
    TextDTP.Visible = False: Adodc1.Enabled = False
    i = 1
Dim rs1 As New ADODB.Recordset
rs1.Open "select * from 车辆事故表", cnn, adOpenKeyset, adLockOptimistic
If rs1.RecordCount > 0 Then
  rs1.MoveLast
  Text1.Text = "SG" + Format(Val(Right(rs1.Fields("事故编号"), 3)) + 1, "###000")
Else
  Text1.Text = "SG001"
End If
End Sub
Private Sub Imgcancel_Click()  '取消
    On Error Resume Next     '当没有添加数据的时候 处理异常
    Adodc1.Recordset.CancelUpdate
    Adodc1.Refresh
    Lockctl
    Imgok.Enabled = False: Imgcancel.Enabled = False
    Imgadd.Enabled = True: Imgupdate.Enabled = True
    Imgdelete.Enabled = True: DTPicker1.Visible = False
    TextDTP.Visible = True: Adodc1.Enabled = True

End Sub

Private Sub Imgdelete_Click()  '删除
    If MsgBox("您确实要删除记录吗?", vbOKCancel, "车辆管理系统") = vbOK Then
        Call main1
        adoCon.Execute ("delete from 车辆事故表 where 事故编号='" & Text1 & "'")
        MsgBox " 记录已删除!", , "车辆管理系统"
        Adodc1.Refresh
        adoCon.Close
    End If

End Sub

Private Sub Imgexit_Click()  '退出
    MDIForm1.StatusBar1.Panels(1).Text = ""
    Unload Me
End Sub
Private Sub Imgok_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
                If Not IsNumeric(Text7.Text) Or Not IsNumeric(Text8.Text) Or Not IsNumeric(Text9.Text) Then
                   MsgBox "请输入有效的数据!", , "车辆管理系统"
                   Exit Sub
                Else
                    cnn.Execute ("insert into 车辆事故表 values ('" & Text1 & "','" & Text2 & "','" & Text3.Text & "','" & Format(DTPicker1.Value, "yyyy-mm-dd") & "','" & Text5 & "','" & Text6 & "','" & Text7 & "','" & Text8 & "','" & Text9 & "','" & Text10 & "','" & Text11 & "','" & Text12 & "','" & Text13 & "','" & Text14 & "')")
                    MsgBox "记录添加成功!", , "车辆管理系统"
                    Adodc1.Refresh
                End If
          Case 2
                 cnn.Execute ("update 车辆事故表 set 车牌号码='" & Text2.Text & "',车辆类型='" & Text3.Text & "',事故时间='" & Format(DTPicker1.Value, "yyyy-mm-dd") & "',事故概要='" & 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
    Imgok.Enabled = False: Imgcancel.Enabled = False
    Imgadd.Enabled = True: Imgupdate.Enabled = True
    Imgdelete.Enabled = True: DTPicker1.Visible = False
    TextDTP.Visible = True: Adodc1.Enabled = True

End Sub

Private Sub Imgupdate_Click() '修改
    Unlockctl
    Imgok.Enabled = True: Imgcancel.Enabled = True
    Imgadd.Enabled = False: Imgdelete.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 = 10155: frmcarSGlr.Height = 3615  '设置窗体大小
  '自动识别路径
  Adodc1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\clgl.mdb;Persist Security Info=False"
  Adodc1.RecordSource = "select * from 车辆事故表"
  Adodc1.Refresh
  
  Adodc2.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\clgl.mdb;Persist Security Info=False"
  Adodc2.RecordSource = "select * from 车辆类型表"
  Adodc2.Refresh
  
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
  Call main1
  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
   adoCon.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 Imgok_Click    '按回车键调用Imgeok_Click()事件
End Sub

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -