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

📄 frmqueryfee.frm

📁 本程序用VB+SQL 2000实现,可以实现小区的住户资料,仪表资料,住户投宿,住户报修等数据的查询,修改,删除,统计和以报表形式打印输出.
💻 FRM
字号:
VERSION 5.00
Begin VB.Form frmQueryFee 
   BorderStyle     =   1  'Fixed Single
   Caption         =   "收费管理查询"
   ClientHeight    =   4560
   ClientLeft      =   45
   ClientTop       =   330
   ClientWidth     =   8460
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MDIChild        =   -1  'True
   MinButton       =   0   'False
   ScaleHeight     =   4560
   ScaleWidth      =   8460
   Begin VB.Frame Frame1 
      Caption         =   "请输入查询条件"
      Height          =   3375
      Left            =   240
      TabIndex        =   13
      Top             =   240
      Width           =   7815
      Begin VB.ComboBox Combo1 
         Height          =   300
         ItemData        =   "frmQueryFee.frx":0000
         Left            =   600
         List            =   "frmQueryFee.frx":0026
         TabIndex        =   0
         Text            =   "Combo1"
         Top             =   720
         Width           =   1095
      End
      Begin VB.TextBox Text1 
         Height          =   375
         Left            =   3360
         TabIndex        =   2
         Top             =   720
         Width           =   2775
      End
      Begin VB.ComboBox Combo3 
         Height          =   300
         ItemData        =   "frmQueryFee.frx":008E
         Left            =   6480
         List            =   "frmQueryFee.frx":009B
         TabIndex        =   3
         Tag             =   "0"
         Text            =   "Combo2"
         Top             =   720
         Width           =   735
      End
      Begin VB.ComboBox Combo4 
         Height          =   300
         ItemData        =   "frmQueryFee.frx":00AD
         Left            =   600
         List            =   "frmQueryFee.frx":00D3
         TabIndex        =   4
         Text            =   "Combo1"
         Top             =   1680
         Width           =   1095
      End
      Begin VB.TextBox Text2 
         Height          =   375
         Left            =   3360
         TabIndex        =   6
         Top             =   1680
         Width           =   2775
      End
      Begin VB.ComboBox Combo6 
         Height          =   300
         ItemData        =   "frmQueryFee.frx":013B
         Left            =   6480
         List            =   "frmQueryFee.frx":0148
         TabIndex        =   7
         Tag             =   "0"
         Text            =   "Combo2"
         Top             =   1680
         Width           =   735
      End
      Begin VB.ComboBox Combo7 
         Height          =   300
         ItemData        =   "frmQueryFee.frx":015A
         Left            =   600
         List            =   "frmQueryFee.frx":0180
         TabIndex        =   8
         Text            =   "Combo1"
         Top             =   2640
         Width           =   1095
      End
      Begin VB.TextBox Text3 
         Height          =   375
         Left            =   3360
         TabIndex        =   10
         Top             =   2640
         Width           =   2775
      End
      Begin VB.ComboBox Combo9 
         Height          =   300
         ItemData        =   "frmQueryFee.frx":01E8
         Left            =   6480
         List            =   "frmQueryFee.frx":01F5
         TabIndex        =   11
         Tag             =   "0"
         Text            =   "Combo2"
         Top             =   2640
         Width           =   735
      End
      Begin VB.ComboBox Combo2 
         Height          =   300
         ItemData        =   "frmQueryFee.frx":0207
         Left            =   2160
         List            =   "frmQueryFee.frx":0214
         TabIndex        =   1
         Text            =   "Combo7"
         Top             =   720
         Width           =   855
      End
      Begin VB.ComboBox Combo5 
         Height          =   300
         ItemData        =   "frmQueryFee.frx":0221
         Left            =   2160
         List            =   "frmQueryFee.frx":022E
         TabIndex        =   5
         Text            =   "Combo7"
         Top             =   1680
         Width           =   855
      End
      Begin VB.ComboBox Combo8 
         Height          =   300
         ItemData        =   "frmQueryFee.frx":023B
         Left            =   2160
         List            =   "frmQueryFee.frx":0248
         TabIndex        =   9
         Text            =   "Combo7"
         Top             =   2640
         Width           =   855
      End
      Begin VB.Label Label1 
         Caption         =   "查找字段"
         Height          =   255
         Left            =   720
         TabIndex        =   26
         Top             =   360
         Width           =   855
      End
      Begin VB.Label Label2 
         Caption         =   "查找值"
         Height          =   255
         Left            =   4560
         TabIndex        =   25
         Top             =   360
         Width           =   615
      End
      Begin VB.Label Label3 
         Caption         =   "逻辑关系"
         Height          =   255
         Left            =   6480
         TabIndex        =   24
         Top             =   360
         Width           =   735
      End
      Begin VB.Label Label4 
         Caption         =   "查找字段"
         Height          =   255
         Left            =   720
         TabIndex        =   23
         Top             =   1320
         Width           =   855
      End
      Begin VB.Label Label5 
         Caption         =   "查找值"
         Height          =   255
         Left            =   4560
         TabIndex        =   22
         Top             =   1320
         Width           =   615
      End
      Begin VB.Label Label6 
         Caption         =   "逻辑关系"
         Height          =   255
         Left            =   6480
         TabIndex        =   21
         Top             =   1320
         Width           =   735
      End
      Begin VB.Label Label7 
         Caption         =   "查找字段"
         Height          =   255
         Left            =   720
         TabIndex        =   20
         Top             =   2280
         Width           =   855
      End
      Begin VB.Label Label8 
         Caption         =   "查找值"
         Height          =   255
         Left            =   4560
         TabIndex        =   19
         Top             =   2280
         Width           =   615
      End
      Begin VB.Label Label9 
         Caption         =   "逻辑关系"
         Height          =   255
         Left            =   6480
         TabIndex        =   18
         Top             =   2280
         Width           =   735
      End
      Begin VB.Label Label10 
         Caption         =   "查找关系"
         Height          =   255
         Left            =   2160
         TabIndex        =   17
         Top             =   360
         Width           =   855
      End
      Begin VB.Label Label11 
         Caption         =   "查找关系"
         Height          =   255
         Left            =   2160
         TabIndex        =   16
         Top             =   1320
         Width           =   855
      End
      Begin VB.Label Label12 
         Caption         =   "查找关系"
         Height          =   255
         Left            =   2160
         TabIndex        =   15
         Top             =   2280
         Width           =   855
      End
   End
   Begin VB.CommandButton cmdQuery 
      Caption         =   "查   询"
      Height          =   495
      Left            =   2280
      TabIndex        =   12
      Top             =   3840
      Width           =   1335
   End
   Begin VB.CommandButton cmdClose 
      Caption         =   "关   闭"
      Height          =   495
      Left            =   4560
      TabIndex        =   14
      Top             =   3840
      Width           =   1335
   End
End
Attribute VB_Name = "frmQueryFee"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub cmdClose_Click()
   Unload Me
End Sub

Private Sub cmdQuery_Click()
'要求至少要有一个查询条件,而且查询条件要靠前写,即如果只有一个查询条件
'必须输在第一行,有2个查询条件,只能输在1,2两行上
   If Text1.Text = "" Then
       MsgBox "请输入至少一个查询条件,或把查询条件输入在前面的行上!", vbOKOnly + vbInformation, "注意"
       Text1.SetFocus
       Text2.Text = ""
       Text3.Text = ""
       Exit Sub
   End If
   If Text2.Text = "" And Not Text3.Text = "" Then
       MsgBox "请把查询条件输入在前面的行上!", vbOKOnly + vbInformation, "注意"
       Text2.SetFocus
       Text3.Text = ""
       Exit Sub
   End If
   '仪表编号和住户姓名查询字段的查询关系不能位 > 或 <,判断之
   For i = 0 To 4
      If Not Text1.Text = "" And Combo1.ListIndex = i And Not Combo2.ListIndex = 0 Then
         MsgBox "该字段的查找关系不能为 > 或 < !", vbOKOnly + vbInformation, "注意"
         Combo2.SetFocus
         Exit Sub
      End If
      If Not Text2.Text = "" And Combo4.ListIndex = i And Not Combo5.ListIndex = 0 Then
         MsgBox "该字段的查找关系不能为 > 或 < !", vbOKOnly + vbInformation, "注意"
         Combo5.SetFocus
         Exit Sub
      End If
      If Not Text3.Text = "" And Combo7.ListIndex = i And Not Combo8.ListIndex = 0 Then
         MsgBox "该字段的查找关系不能为 > 或 < !", vbOKOnly + vbInformation, "注意"
         Combo8.SetFocus
         Exit Sub
      End If
   Next i
   
   '以下分别该2个选项卡处理查询条件
   If frmCharge.SSTab1.Tab = 0 Then
      '设置查询判断变量为真
      queryWuYeFee = True
   ElseIf frmCharge.SSTab1.Tab = 1 Then
      queryYiBiaoFee = True
   End If
   
   '使用全局变量sqlfee保存该查询表达式的sql 语句
   '如果查询字段是数字和日期,则需要转换text1.text的内容
   
   'i=1 to 4 为文本型字段,i=5 to 9为数字型字段
   For i = 0 To 4
      If Combo1.ListIndex = i Then
         sqlFee = "where " & Combo1.Text & Combo2.Text & "'" & Text1.Text & "'"
      ElseIf Combo1.ListIndex = i + 5 Then
         sqlFee = "where " & Combo1.Text & Combo2.Text & Val(Text1.Text)
      End If
   Next i
   '最后一个为日期型字段
   If Combo1.ListIndex = 10 Then
      If IsDate(Text1.Text) = False Then
         MsgBox "输入的不是日期型内容,请输入这样的日期格式:2003-8-3!", vbOKOnly + vbInformation, "注意"
         Exit Sub
      End If
      sqlFee = "where " & Combo1.Text & Combo2.Text & "#" & DateValue(Text1.Text) & "#"
   End If
   
   'text2的处理
   If Not Text2.Text = "" Then
      For i = 0 To 4
          If Combo4.ListIndex = i Then
             'combo3.text是and or not 等逻辑字符,其前后需要各加上一个空格
             sqlFee = sqlFee & " " & Combo3.Text & " " & Combo4.Text & Combo5.Text & "'" & Text2.Text & "'"
          ElseIf Combo4.ListIndex = i + 5 Then
              '查询字段是年份和月份,为整型,需用Val转换字符串为数字
              'Val 函数把字符串转换为数字
              sqlFee = sqlFee & " " & Combo3.Text & " " & Combo4.Text & Combo5.Text & Val(Text2.Text)
          End If
      Next i
      '最后一个为日期型
      If Combo4.ListIndex = 10 Then
         If IsDate(Text2.Text) = False Then
             MsgBox "输入的不是日期型内容,请输入这样的日期格式:2003-8-3!", vbOKOnly + vbInformation, "注意"
             Exit Sub
          End If
         'DateValue 函数把字符串转换为日期
         sqlFee = sqlFee & " " & Combo3.Text & " " & Combo4.Text & Combo5.Text & "#" & DateValue(Text2.Text) & "#"
      End If
   End If
   
   'text3的处理
   If Not Text3.Text = "" Then
      For i = 0 To 4
         If Combo7.ListIndex = i Then
            sqlFee = sqlFee & " " & Combo6.Text & " " & Combo7.Text & Combo8.Text & "'" & Text3.Text & "'"
         ElseIf Combo7.ListIndex = i + 5 Then
            'Val 函数把字符串转换为数字
            sqlFee = sqlFee & " " & Combo6.Text & " " & Combo7.Text & Combo8.Text & Val(Text3.Text)
         End If
      Next i
      If Combo7.ListIndex = 10 Then
         If IsDate(Text3.Text) = False Then
             MsgBox "输入的不是日期型内容,请输入这样的日期格式:2003-8-3!", vbOKOnly + vbInformation, "注意"
             Exit Sub
          End If
         'DateValue 函数把字符串转换为日期
         sqlFee = sqlFee & " " & Combo6.Text & " " & Combo7.Text & Combo8.Text & "#" & DateValue(Text3.Text) & "#"
      End If
   End If
   
   frmCharge.Show
   Unload Me
End Sub

Private Sub Form_Load()
   '让窗体居中
   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
   Combo1.ListIndex = 0
   Combo2.ListIndex = 0
   Combo3.ListIndex = 0
   Combo4.ListIndex = 0
   Combo5.ListIndex = 0
   Combo6.ListIndex = 0
   Combo7.ListIndex = 0
   Combo8.ListIndex = 0
   Combo9.ListIndex = 0
   Text1.Text = ""
   Text2.Text = ""
   Text3.Text = ""
End Sub




⌨️ 快捷键说明

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