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

📄 frmaccidentlist.frm

📁 车辆管理系统是一个协助各单位进行全面的车辆管理的系统。包括车辆档案管理;驾驶员档案管理;车辆运营信息管理;车辆事故信息管理;车辆维修信息管理;车辆费用管理等几个功能模块。
💻 FRM
字号:
VERSION 5.00
Object = "{5E9E78A0-531B-11CF-91F6-C2863C385E30}#1.0#0"; "MSFLXGRD.OCX"
Begin VB.Form frmaccidentlist 
   Caption         =   "事故信息"
   ClientHeight    =   5550
   ClientLeft      =   3660
   ClientTop       =   2040
   ClientWidth     =   7380
   LinkTopic       =   "Form1"
   MDIChild        =   -1  'True
   ScaleHeight     =   5550
   ScaleWidth      =   7380
   Begin VB.CommandButton Command2 
      Caption         =   "报  表"
      Height          =   375
      Left            =   1800
      TabIndex        =   3
      Top             =   360
      Width           =   1335
   End
   Begin VB.CommandButton Command1 
      Caption         =   "导出数据"
      Height          =   375
      Left            =   480
      TabIndex        =   2
      Top             =   360
      Width           =   1215
   End
   Begin MSFlexGridLib.MSFlexGrid msglist 
      Height          =   4575
      Left            =   480
      TabIndex        =   0
      Top             =   720
      Width           =   6495
      _ExtentX        =   11456
      _ExtentY        =   8070
      _Version        =   393216
   End
   Begin VB.Label Lbltitle 
      Caption         =   "事故信息列表"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   12
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   495
      Left            =   4440
      TabIndex        =   1
      Top             =   120
      Width           =   2175
   End
End
Attribute VB_Name = "frmaccidentlist"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Public txtsql As String
'Public aexcel As Boolean
Dim mrc As ADODB.Recordset
Dim msgtext As String

Private Sub Command1_Click()
   Call excldata
End Sub

Private Sub Command2_Click()
   Dim oSHT As LLanV.LLAN_VIEW
   Dim aLab() As String
   Dim aTxt() As String
   Dim aPer() As Double
   Dim nLen As Long
   Dim i As Long

   ReDim aLab(5)
   ReDim aTxt(5)
   ReDim aPer(5)
   nLen = 7
For i = 0 To 5
    aPer(i) = 0.33   ''各项的宽度权数
Next

Dim sConDesc As String

sConDesc = "FileDSN=myconnection.dsn;UID=sa;PWD="

Set oSHT = New LLanV.LLAN_VIEW

Call oSHT.OnSetCN_STR(sConDesc)

Call oSHT.OnSetSQL("select  * from accident")

'Call oSHT.OnSetPath(App.Path & "\IMG")

Call oSHT.OnRun("事故车辆报表", aLab, aTxt, aPer, 0)

End Sub

Private Sub Form_Load()
 showtitle
 showdata
 'flagtoexcel = 1
 'If aexcel = True Then
 '   excldata
' End If
 Call Form_Resize
 flagaEdit = True
 
End Sub

Public Sub showtitle()
  Dim i As Integer
      With msglist
           .Cols = 11
           .TextMatrix(0, 1) = "车辆牌照"
           .TextMatrix(0, 2) = "司机"
           .TextMatrix(0, 3) = "事故日期"
           .TextMatrix(0, 4) = "事故地点"
           .TextMatrix(0, 5) = "事故原因"
           .TextMatrix(0, 6) = "对方单位"
           .TextMatrix(0, 7) = "对方车牌"
           .TextMatrix(0, 8) = "处理意见"
           .TextMatrix(0, 9) = "处理金额"
           .TextMatrix(0, 10) = "备注"
           .FixedRows = 1
           For i = 0 To 10
               .ColAlignment(i) = 0
           Next i
           .FillStyle = flexFillRepeat
           .Col = 0
           .Row = 0
           .RowSel = 1
           .ColSel = .Cols - 1
           .CellAlignment = 4
           .ColWidth(0) = 300
           .ColWidth(1) = 1000
           .ColWidth(2) = 1000
           .ColWidth(3) = 1400
           .ColWidth(4) = 1800
           .ColWidth(5) = 1800
           .ColWidth(6) = 1500
           .ColWidth(7) = 1000
           .ColWidth(8) = 1800
           .ColWidth(9) = 800
           .ColWidth(10) = 1800
           .Row = 1
     End With
           
End Sub


Public Sub showdata()
  Dim i As Integer
  Dim j As Integer
  If txtsql = "" Then
     txtsql = "select * from accident"
     Set mrc = ExecuteSQL(txtsql, msgtext)
  Else
     Set mrc = ExecuteSQL(txtsql, msgtext)
     If mrc.EOF = True Then
        MsgBox "找不到你想要做的数据", vbOKOnly + vbExclamation, "警告"
        Exit Sub
     End If
  End If
  With msglist
       .Rows = 1
       Do While Not mrc.EOF
          .Rows = .Rows + 1
          For i = 1 To mrc.Fields.Count
              If mrc.Fields(i - 1).Type = adDBDate Then
                 .TextMatrix(.Rows - 1, i) = Format(mrc.Fields(i - 1) & "", "yyyy-mm-dd")
              Else
                 .TextMatrix(.Rows - 1, i) = mrc.Fields(i - 1) & ""
              End If
          Next i
          mrc.MoveNext
       Loop
  End With
End Sub

Private Sub Form_Resize()
    If Me.WindowState <> vbMinimized And fMainForm.WindowState <> vbMinimized Then
       
        If Me.ScaleHeight < 10 * lbltitle.Height Then               '边界处理
            
            Exit Sub
        End If
        If Me.ScaleWidth < lbltitle.Width + lbltitle.Width / 2 Then
            
            Exit Sub
        End If
       
                
        lbltitle.Top = lbltitle.Height                  '控制控件的位置
        lbltitle.Left = (Me.Width - lbltitle.Width) / 2
        
        msglist.Top = lbltitle.Top + lbltitle.Height + lbltitle.Height / 2
        msglist.Width = Me.ScaleWidth - 200
        msglist.Left = Me.ScaleLeft + 100
        msglist.Height = Me.ScaleHeight - msglist.Top - 200
    End If
End Sub

Private Sub Form_Unload(Cancel As Integer)
   flagaEdit = False
   gintaMode = 0
   Unload Me
 '  flagtoexcel = 0
End Sub


Private Sub msglist_MouseUp(Button As Integer, Shift As Integer, x As Single, y As Single)
   If Button = 2 And Shift = 0 Then
     PopupMenu fMainForm.sgxxgl
  End If
End Sub

Public Sub excldata()
    Dim xlApp As Excel.Application
    Dim xlBook As Excel.Workbook
    Dim xlSheet As Excel.Worksheet
    Dim i As Long, j As Long
    On Error GoTo ErrorHandle
    Set xlApp = CreateObject("Excel.Application")
    Set xlBook = xlApp.Workbooks.Add
    Set xlSheet = xlBook.Worksheets(1)
  
    For i = 0 To msglist.Rows - 1
        For j = 0 To msglist.Cols - 1
            xlSheet.Cells(i + 1, j + 1).Value = msglist.TextMatrix(i, j)
        Next j
    Next i
    xlSheet.Application.Visible = True
    Set xlSheet = Nothing
    Set xlBook = Nothing
    Set xlApp = Nothing
    Exit Sub
ErrorHandle:
    MsgBox "错误:" & Err.Number & vbCrLf & Err.Description, vbOKOnly, "运行错误!"
End Sub

⌨️ 快捷键说明

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