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

📄 frmwatermeterinput_cbyselect.frm

📁 自来水公司的一个管理系统
💻 FRM
字号:
VERSION 5.00
Object = "{C932BA88-4374-101B-A56C-00AA003668DC}#1.1#0"; "MSMASK32.OCX"
Begin VB.Form frmWaterMeterInput_CBYSelect 
   BorderStyle     =   1  'Fixed Single
   Caption         =   "抄表员选择"
   ClientHeight    =   1830
   ClientLeft      =   45
   ClientTop       =   330
   ClientWidth     =   5610
   Icon            =   "frmWaterMeterInput_CBYSelect.frx":0000
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   MouseIcon       =   "frmWaterMeterInput_CBYSelect.frx":0442
   ScaleHeight     =   1830
   ScaleWidth      =   5610
   StartUpPosition =   2  '屏幕中心
   Begin VB.CommandButton cmdOK 
      Caption         =   "确定"
      Height          =   390
      Left            =   180
      TabIndex        =   1
      Top             =   1260
      Width           =   1065
   End
   Begin VB.Frame Frame1 
      Caption         =   "抄表员"
      ForeColor       =   &H00800000&
      Height          =   1005
      Left            =   150
      TabIndex        =   2
      Top             =   120
      Width           =   5325
      Begin VB.TextBox txtPost 
         Enabled         =   0   'False
         Height          =   300
         Left            =   3585
         TabIndex        =   6
         Top             =   420
         Width           =   1050
      End
      Begin VB.TextBox txtName 
         Enabled         =   0   'False
         Height          =   300
         Left            =   1965
         TabIndex        =   3
         Top             =   420
         Width           =   1050
      End
      Begin MSMask.MaskEdBox txtID 
         Height          =   300
         Left            =   630
         TabIndex        =   0
         Top             =   420
         Width           =   720
         _ExtentX        =   1270
         _ExtentY        =   529
         _Version        =   393216
         MaxLength       =   3
         Mask            =   "999"
         PromptChar      =   " "
      End
      Begin VB.Label Label1 
         Caption         =   "岗位"
         Height          =   285
         Index           =   2
         Left            =   3135
         TabIndex        =   7
         Top             =   465
         Width           =   420
      End
      Begin VB.Label Label1 
         Caption         =   "名称"
         Height          =   285
         Index           =   1
         Left            =   1515
         TabIndex        =   5
         Top             =   465
         Width           =   420
      End
      Begin VB.Label Label1 
         Caption         =   "编号"
         Height          =   285
         Index           =   0
         Left            =   195
         TabIndex        =   4
         Top             =   465
         Width           =   420
      End
   End
End
Attribute VB_Name = "frmWaterMeterInput_CBYSelect"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit

Public strReturnCgID As String

Private Sub cmdOK_Click()
    strReturnCgID = Trim(Me.txtID.Text)
    Unload Me
End Sub

Private Sub Form_Load()
    strReturnCgID = ""
End Sub

Private Sub txtID_GotFocus()
    Call AutoSelectText(txtID)
End Sub

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

Private Sub txtID_LostFocus()
    Dim adoTmpRS As ADODB.Recordset
    Dim strSQL As String
    
    If Trim(Me.txtID.Text) = "" Then
        Me.txtName.Text = ""
        Me.txtPost.Text = ""
        Me.txtID.SetFocus
        Exit Sub
    End If
    Me.txtID.Text = String(3 - Len(Trim(Me.txtID.Text)), "0") & Trim(Me.txtID.Text)
    
    strSQL = "select EID,Name,PostName from Employee,Post where EID='" & Trim(Me.txtID.Text) & "' and Employee.PostID = Post.PostID"
    On Error GoTo ErrHandleExe
    Set adoTmpRS = gConnect.Execute(strSQL)
    On Error GoTo 0
       
    If adoTmpRS.EOF And adoTmpRS.BOF Then
        Me.txtName.Text = ""
        Me.txtPost.Text = ""
        Warning "无该编号人员!!!"
        Me.txtID.SetFocus
        Exit Sub
    End If
    Me.txtName.Text = Trim(adoTmpRS!Name)
    Me.txtPost.Text = Trim(adoTmpRS!PostName)
    On Error Resume Next
    adoTmpRS.Close
    Set adoTmpRS = Nothing
    On Error GoTo 0
    
    Exit Sub
    '-------错误处理---------
ErrHandleExe:
    On Error GoTo 0
    Warning "查询抄表员编号失败!" & Chr(13) & Err.Description
    Me.txtID.Text = "   "
    Me.txtName.Text = ""
    Me.txtPost.Text = ""
    Me.txtID.Enabled = False
    Me.cmdOK.Enabled = False
    strReturnCgID = ""

    On Error Resume Next
    adoTmpRS.Close
    Set adoTmpRS = Nothing
    On Error GoTo 0
End Sub

⌨️ 快捷键说明

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