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

📄 frmtgtousu.frm

📁 本程序用VB+SQL 2000实现,可以实现小区的住户资料,仪表资料,住户投宿,住户报修等数据的查询,修改,删除,统计和以报表形式打印输出.
💻 FRM
字号:
VERSION 5.00
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Object = "{CDE57A40-8B86-11D0-B3C6-00A0C90AEA82}#1.0#0"; "MSDATGRD.OCX"
Begin VB.Form frmTgTouSu 
   BorderStyle     =   1  'Fixed Single
   Caption         =   "住户投诉统计"
   ClientHeight    =   5640
   ClientLeft      =   45
   ClientTop       =   330
   ClientWidth     =   8430
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MDIChild        =   -1  'True
   MinButton       =   0   'False
   ScaleHeight     =   5640
   ScaleWidth      =   8430
   Begin VB.Frame Frame1 
      Caption         =   "选择排序方式"
      Height          =   735
      Left            =   3960
      TabIndex        =   1
      Top             =   4080
      Width           =   3855
      Begin VB.CommandButton cmdOrder 
         Caption         =   "排 序"
         Height          =   255
         Left            =   3000
         TabIndex        =   3
         Top             =   240
         Width           =   735
      End
      Begin VB.ComboBox Combo1 
         Height          =   300
         ItemData        =   "frmTgTouSu.frx":0000
         Left            =   1320
         List            =   "frmTgTouSu.frx":0016
         TabIndex        =   2
         Text            =   "Combo1"
         Top             =   240
         Width           =   1575
      End
      Begin VB.Label Label1 
         Caption         =   "排序方式"
         Height          =   255
         Left            =   240
         TabIndex        =   4
         Top             =   240
         Width           =   855
      End
   End
   Begin MSDataGridLib.DataGrid DataGrid2 
      Height          =   1695
      Left            =   240
      TabIndex        =   0
      Top             =   3600
      Width           =   3495
      _ExtentX        =   6165
      _ExtentY        =   2990
      _Version        =   393216
      HeadLines       =   1
      RowHeight       =   15
      BeginProperty HeadFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "宋体"
         Size            =   9
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "宋体"
         Size            =   9
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ColumnCount     =   2
      BeginProperty Column00 
         DataField       =   ""
         Caption         =   ""
         BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
            Type            =   0
            Format          =   ""
            HaveTrueFalseNull=   0
            FirstDayOfWeek  =   0
            FirstWeekOfYear =   0
            LCID            =   2052
            SubFormatType   =   0
         EndProperty
      EndProperty
      BeginProperty Column01 
         DataField       =   ""
         Caption         =   ""
         BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
            Type            =   0
            Format          =   ""
            HaveTrueFalseNull=   0
            FirstDayOfWeek  =   0
            FirstWeekOfYear =   0
            LCID            =   2052
            SubFormatType   =   0
         EndProperty
      EndProperty
      SplitCount      =   1
      BeginProperty Split0 
         BeginProperty Column00 
         EndProperty
         BeginProperty Column01 
         EndProperty
      EndProperty
   End
   Begin MSDataGridLib.DataGrid DataGrid1 
      Height          =   3135
      Left            =   240
      TabIndex        =   5
      Top             =   240
      Width           =   7695
      _ExtentX        =   13573
      _ExtentY        =   5530
      _Version        =   393216
      HeadLines       =   1
      RowHeight       =   15
      BeginProperty HeadFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "宋体"
         Size            =   9
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "宋体"
         Size            =   9
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ColumnCount     =   2
      BeginProperty Column00 
         DataField       =   ""
         Caption         =   ""
         BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
            Type            =   0
            Format          =   ""
            HaveTrueFalseNull=   0
            FirstDayOfWeek  =   0
            FirstWeekOfYear =   0
            LCID            =   2052
            SubFormatType   =   0
         EndProperty
      EndProperty
      BeginProperty Column01 
         DataField       =   ""
         Caption         =   ""
         BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
            Type            =   0
            Format          =   ""
            HaveTrueFalseNull=   0
            FirstDayOfWeek  =   0
            FirstWeekOfYear =   0
            LCID            =   2052
            SubFormatType   =   0
         EndProperty
      EndProperty
      SplitCount      =   1
      BeginProperty Split0 
         BeginProperty Column00 
         EndProperty
         BeginProperty Column01 
         EndProperty
      EndProperty
   End
   Begin MSAdodcLib.Adodc Adodc1 
      Height          =   330
      Left            =   5640
      Top             =   3720
      Visible         =   0   'False
      Width           =   1935
      _ExtentX        =   3413
      _ExtentY        =   582
      ConnectMode     =   0
      CursorLocation  =   3
      IsolationLevel  =   -1
      ConnectionTimeout=   15
      CommandTimeout  =   30
      CursorType      =   3
      LockType        =   3
      CommandType     =   2
      CursorOptions   =   0
      CacheSize       =   50
      MaxRecords      =   0
      BOFAction       =   0
      EOFAction       =   0
      ConnectStringType=   3
      Appearance      =   1
      BackColor       =   -2147483643
      ForeColor       =   -2147483640
      Orientation     =   0
      Enabled         =   -1
      Connect         =   "DSN=XiaoQu"
      OLEDBString     =   ""
      OLEDBFile       =   ""
      DataSourceName  =   "XiaoQu"
      OtherAttributes =   ""
      UserName        =   ""
      Password        =   ""
      RecordSource    =   "TouSu"
      Caption         =   "Adodc1"
      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
End
Attribute VB_Name = "frmTgTouSu"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim rs_tousu As New ADODB.Recordset
Dim rs_order As New ADODB.Recordset
Dim rs_tg As New ADODB.Recordset
Private Sub cmdOrder_Click()
   
   Dim sql As String
   If rs_order.State = adStateOpen Then
      rs_order.Close
   End If
   sql = "select * from TouSu order by " & Combo1.Text
   rs_order.CursorLocation = adUseClient
   rs_order.Open sql, conn, adOpenStatic, adLockOptimistic
   '设置DataGrid1的数据源
   Set DataGrid1.DataSource = rs_order
   DataGrid1.Refresh
   
   '使用分组统计,并显示在DataGrid2中
      '首先需要设置DataGrid2可见
      DataGrid2.Visible = True
       '设置网格不可写
      DataGrid2.AllowAddNew = False
      DataGrid2.AllowDelete = False
      DataGrid2.AllowUpdate = False
      Dim sql2 As String
      '下面的sql语句已用户选择的combo1.text分组、排序,并且统计同一个combo1.text的数量
      sql2 = "select " & Combo1.Text & ", count( " & Combo1.Text & _
      " ) as 数量统计 from TouSu group by " & Combo1.Text & " order by " & Combo1.Text
      If rs_tg.State = adStateOpen Then
         rs_tg.Close
      End If
      rs_tg.CursorLocation = adUseClient
      rs_tg.Open sql2, conn, adOpenStatic, adLockOptimistic
      '设置DataGrid2的数据源
      Set DataGrid2.DataSource = rs_tg
      DataGrid2.Refresh
   
End Sub


Private Sub Form_activate()
   Dim X0 As Long
   Dim Y0 As Long
   '让窗体居中
   X0 = Screen.Width
   Y0 = Screen.Height
   X0 = (X0 - Me.Width) / 2
   Y0 = (Y0 - Me.Height) / 2
   Me.Move X0, Y0
   '开始时设置用于统计的DataGrid2为不可见
   DataGrid2.Visible = False
   '设置Adodc控件不可见
   Adodc1.Visible = False
   '设置网格不可写
   DataGrid1.AllowAddNew = False
   DataGrid1.AllowDelete = False
   DataGrid1.AllowUpdate = False
   Combo1.ListIndex = 0
   '显示全部数据,而不是查询结果数据
   Dim sql As String
   sql = "select * from TouSu order by 投诉编号"
   rs_tousu.CursorLocation = adUseClient
   rs_tousu.Open sql, conn, adOpenStatic, adLockOptimistic
   '设置DataGrid1的数据源
   Set DataGrid1.DataSource = rs_tousu
   DataGrid1.Refresh
End Sub

Private Sub Form_Unload(Cancel As Integer)
   '使网格的数据源转向空的Adodc控件,否则有可能无法关闭
   Set DataGrid1.DataSource = Adodc1
   DataGrid1.Refresh
   rs_tousu.Close
   If rs_order.State = adStateOpen Then
      rs_order.Close
   End If
   If rs_tg.State = adStateOpen Then
      rs_tg.Close
   End If
End Sub



⌨️ 快捷键说明

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