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

📄 frmmainwatermeterfixinsteadquery_select.frm

📁 自来水公司的一个管理系统
💻 FRM
字号:
VERSION 5.00
Object = "{C932BA88-4374-101B-A56C-00AA003668DC}#1.1#0"; "MSMASK32.OCX"
Begin VB.Form frmMainWaterMeterFixInsteadQuery_Select 
   BorderStyle     =   1  'Fixed Single
   Caption         =   "查询条件选择"
   ClientHeight    =   2055
   ClientLeft      =   45
   ClientTop       =   330
   ClientWidth     =   5805
   Icon            =   "frmMainWaterMeterFixInsteadQuery_Select.frx":0000
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   2055
   ScaleWidth      =   5805
   StartUpPosition =   1  '所有者中心
   Begin VB.Frame Frame1 
      Caption         =   "查询条件"
      ForeColor       =   &H8000000D&
      Height          =   1215
      Left            =   75
      TabIndex        =   4
      Top             =   120
      Width           =   5610
      Begin VB.ComboBox cboMonth 
         Height          =   300
         ItemData        =   "frmMainWaterMeterFixInsteadQuery_Select.frx":0442
         Left            =   3195
         List            =   "frmMainWaterMeterFixInsteadQuery_Select.frx":0444
         Style           =   2  'Dropdown List
         TabIndex        =   1
         Top             =   285
         Width           =   870
      End
      Begin VB.OptionButton optSearch 
         Caption         =   "按总表编号查询"
         Height          =   195
         Index           =   1
         Left            =   300
         TabIndex        =   6
         Top             =   750
         Width           =   1665
      End
      Begin VB.OptionButton optSearch 
         Caption         =   "按计费时段查询"
         Height          =   195
         Index           =   0
         Left            =   300
         TabIndex        =   5
         Top             =   360
         Value           =   -1  'True
         Width           =   1665
      End
      Begin MSMask.MaskEdBox txtYear 
         Height          =   300
         Left            =   2025
         TabIndex        =   0
         Top             =   285
         Width           =   825
         _ExtentX        =   1455
         _ExtentY        =   529
         _Version        =   393216
         MaxLength       =   4
         Mask            =   "9999"
         PromptChar      =   " "
      End
      Begin MSMask.MaskEdBox txtMWmID 
         Height          =   300
         Left            =   2010
         TabIndex        =   2
         Top             =   690
         Width           =   2055
         _ExtentX        =   3625
         _ExtentY        =   529
         _Version        =   393216
         Enabled         =   0   'False
         MaxLength       =   6
         Mask            =   "999999"
         PromptChar      =   " "
      End
      Begin VB.Label Label1 
         Caption         =   "年"
         Height          =   210
         Index           =   2
         Left            =   2910
         TabIndex        =   8
         Top             =   345
         Width           =   210
      End
      Begin VB.Label Label1 
         Caption         =   "月份"
         Height          =   210
         Index           =   3
         Left            =   4095
         TabIndex        =   7
         Top             =   345
         Width           =   435
      End
   End
   Begin VB.CommandButton cmdCB 
      Caption         =   "确定"
      Height          =   420
      Index           =   0
      Left            =   120
      TabIndex        =   3
      Top             =   1545
      Width           =   1065
   End
   Begin VB.Line Line1 
      BorderColor     =   &H80000003&
      Index           =   1
      X1              =   30
      X2              =   5700
      Y1              =   1425
      Y2              =   1425
   End
   Begin VB.Line Line1 
      BorderColor     =   &H80000005&
      Index           =   0
      X1              =   30
      X2              =   5715
      Y1              =   1440
      Y2              =   1440
   End
End
Attribute VB_Name = "frmMainWaterMeterFixInsteadQuery_Select"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit

Public strReturnYear As String
Public strReturnMonth As String
Public strReturnMWmID As String

Private Sub cmdCB_Click(Index As Integer)
    strReturnYear = Trim(Me.txtYear.Text)
    strReturnMonth = Me.cboMonth.Text
    strReturnMWmID = Trim(Me.txtMWmID.Text)
    Unload Me
End Sub

Private Sub Form_Load()
    strReturnYear = ""
    strReturnMonth = ""
    strReturnMWmID = ""

    Me.txtYear.Text = Trim(Str(Year(Date)))
    Call FillMonth
End Sub

Private Sub FillMonth()
    Me.cboMonth.Clear
    Me.cboMonth.AddItem "01"
    Me.cboMonth.AddItem "02"
    Me.cboMonth.AddItem "03"
    Me.cboMonth.AddItem "04"
    Me.cboMonth.AddItem "05"
    Me.cboMonth.AddItem "06"
    Me.cboMonth.AddItem "07"
    Me.cboMonth.AddItem "08"
    Me.cboMonth.AddItem "09"
    Me.cboMonth.AddItem "10"
    Me.cboMonth.AddItem "11"
    Me.cboMonth.AddItem "12"
    Me.cboMonth.ListIndex = Month(Date) - 1
End Sub

Private Sub ClearMonth()
    Me.cboMonth.Clear
End Sub


Private Sub optSearch_Click(Index As Integer)
    If Index = 0 Then
        Me.txtYear.Text = Trim(Str(Year(Date)))
        Call FillMonth
        Me.txtYear.Enabled = True
        Me.cboMonth.Enabled = True
        Me.txtYear.SetFocus
    
        Me.txtMWmID.Text = "      "
        Me.txtMWmID.Enabled = False
    Else
        Me.txtYear.Text = "    "
        Call ClearMonth
        Me.txtYear.Enabled = False
        Me.cboMonth.Enabled = False
        
        Me.txtMWmID.Enabled = True
        Me.txtMWmID.SetFocus
    End If
End Sub

Private Sub txtMWmID_GotFocus()
    Call AutoSelectText(txtMWmID)
End Sub

Private Sub txtMWmID_KeyPress(KeyAscii As Integer)
    Call IfEnterKeyMoveNext(KeyAscii)
End Sub

Private Sub txtMWmID_LostFocus()
    Dim strSQL As String
    Dim adoTmpRS As ADODB.Recordset
    
    If Trim(Me.txtMWmID.Text) = "" Then Exit Sub
    
    Me.txtMWmID.Text = String(gMWmIDLen - Len(Trim(Me.txtMWmID.Text)), "0") & Trim(Me.txtMWmID.Text)
    
'------------------------
'注:下列代码废弃原因:由于总表更换后原总表号在总表表中就不存在了,因此就无法查到,故废弃下列代码
'------------------------
'    strSQL = "select MWmID from MWatermeter where MWmID='" & Trim(Me.txtMWmID.Text) & "'"
'    On Error GoTo ErrHandleExe
'    Set adoTmpRS = gConnect.Execute(strSQL)
'    On Error GoTo 0
'    If adoTmpRS.EOF And adoTmpRS.BOF Then
'        Warning "该总表编号不存在!"
'        Me.txtMWmID.SetFocus
'    End If
'    On Error Resume Next
'    adoTmpRS.Close
'    Set adoTmpRS = Nothing
'    On Error GoTo 0
'
'    Exit Sub
'    '-------错误处理---------
'ErrHandleExe:
'    Warning "总表编号查询错误!" & Chr(13) & Err.Description
'    On Error GoTo 0
'    Me.txtMWmID.SetFocus
End Sub

Private Sub txtYear_GotFocus()
    Call AutoSelectText(txtYear)
End Sub

Private Sub txtYear_KeyPress(KeyAscii As Integer)
    Call IfEnterKeyMoveNext(KeyAscii)
End Sub

Private Sub cboMonth_KeyPress(KeyAscii As Integer)
    Call IfEnterKeyMoveNext(KeyAscii)
End Sub

Private Sub txtYear_LostFocus()
    If Val(Me.txtYear.Text) < 1900 Or Val(Me.txtYear.Text) > 9999 Then
        Warning "年份格式输入错误!!!"
        Me.txtYear.SetFocus
    End If
End Sub

⌨️ 快捷键说明

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