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

📄 frmznjgl.frm

📁 自来水公司的一个管理系统
💻 FRM
字号:
VERSION 5.00
Object = "{C932BA88-4374-101B-A56C-00AA003668DC}#1.1#0"; "MSMASK32.OCX"
Object = "{788A625E-3B1F-4033-A5F8-E30D17B1FF43}#6.0#0"; "DecEdBox.ocx"
Begin VB.Form frmZNJGL 
   BorderStyle     =   1  'Fixed Single
   Caption         =   "滞纳金信息"
   ClientHeight    =   2130
   ClientLeft      =   45
   ClientTop       =   330
   ClientWidth     =   7635
   Icon            =   "frmZNJGL.frx":0000
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MDIChild        =   -1  'True
   MinButton       =   0   'False
   ScaleHeight     =   2130
   ScaleWidth      =   7635
   Begin VB.Frame Frame1 
      Height          =   1230
      Left            =   150
      TabIndex        =   4
      Top             =   600
      Width           =   7275
      Begin DecEdBox.DecEditBox txtZNJ 
         Height          =   315
         Left            =   1065
         TabIndex        =   0
         Top             =   255
         Width           =   1425
         _ExtentX        =   2514
         _ExtentY        =   556
      End
      Begin MSMask.MaskEdBox txtComment 
         Height          =   315
         Left            =   1065
         TabIndex        =   1
         Top             =   615
         Width           =   6075
         _ExtentX        =   10716
         _ExtentY        =   556
         _Version        =   393216
         MaxLength       =   60
         PromptChar      =   " "
      End
      Begin VB.Label Label2 
         Caption         =   "描述:"
         Height          =   240
         Left            =   330
         TabIndex        =   7
         Top             =   750
         Width           =   600
      End
      Begin VB.Label Label1 
         Caption         =   "滞纳金:"
         Height          =   240
         Left            =   315
         TabIndex        =   6
         Top             =   330
         Width           =   870
      End
      Begin VB.Label Label3 
         Caption         =   "元"
         Height          =   210
         Left            =   2580
         TabIndex        =   5
         Top             =   345
         Width           =   240
      End
   End
   Begin VB.CommandButton cmdCancel 
      Caption         =   "放弃"
      Height          =   360
      Left            =   1290
      TabIndex        =   3
      Top             =   195
      Width           =   1125
   End
   Begin VB.CommandButton cmdSave 
      Caption         =   "保存"
      Height          =   360
      Left            =   180
      TabIndex        =   2
      Top             =   195
      Width           =   1125
   End
End
Attribute VB_Name = "frmZNJGL"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim blnModificationFlag As Boolean '修改标志,对本表单的任何改动都将置为ture
'Dim adoZnjRS As ADODB.Recordset

Private Sub cmdCancel_Click()
    If Not blnModificationFlag Then Exit Sub
        
    Call LoadData
    blnModificationFlag = False
End Sub

Private Sub cmdSave_Click()
    Dim bytReturnFlag As Byte
    
    If Not blnModificationFlag Then Exit Sub
    
    bytReturnFlag = MsgBox("确定要保存吗?", vbOKCancel + vbInformation, "提示信息")
    If bytReturnFlag = vbCancel Then
        Call cmdCancel_Click
        Exit Sub
    End If
    Call SaveData
    blnModificationFlag = False
End Sub

Private Sub Form_Load()
    MoveToCenter gMainFormRefer, Me
    Me.txtZNJ.MaxLen = 6
    Call LoadData
    blnModificationFlag = False
End Sub

Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
    
End Sub

Private Sub txtComment_Change()
    blnModificationFlag = True
End Sub

Private Sub txtComment_GotFocus()
    Call AutoSelectText(Me.txtComment)
End Sub

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

Private Sub txtZNJ_Change()
    blnModificationFlag = True
End Sub

Private Sub txtZNJ_GotFocus()
'   本控件(自制)内部已经有自动选择的功能了
'    Me.txtZNJ.Text = Me.txtZNJ.FormattedText
'    Call AutoSelectText(Me.txtZNJ)
End Sub

Private Sub txtZNJ_KeyPress(ByVal KeyAscii As Integer)
    Call IfEnterKeyMoveNext(KeyAscii)
End Sub

Private Sub SaveData()
    '将目前表单上的内容填入数据库
    Dim strSQL As String
    strSQL = "update FineRule set FineRule='" & Me.txtZNJ.Text & "',Comment='" & Trim(Me.txtComment.Text) & "'"
    On Error Resume Next
    gConnect.Execute strSQL
    Call Warning("数据库更新失败!" & Chr(13) & Err.Description)
    On Error GoTo 0
End Sub

Private Sub LoadData()
    '用表中的内容更新目前表单上的内容
    Dim adoZnjRS As ADODB.Recordset
    
    On Error GoTo ErrHandleOpen
    Set adoZnjRS = New ADODB.Recordset
    Set adoZnjRS.ActiveConnection = gConnect
    adoZnjRS.CursorLocation = adUseClient
    adoZnjRS.CursorType = adOpenForwardOnly
    adoZnjRS.LockType = adLockOptimistic
    adoZnjRS.Open "select FineRule,Comment from FineRule"
    On Error GoTo 0
    
    If adoZnjRS.EOF And adoZnjRS.BOF Then
        '如果是空表,就首先增加一条初始记录
        On Error GoTo ErrHandleAdd
        adoZnjRS.AddNew
        adoZnjRS!FineRule = 0
        adoZnjRS!Comment = ""
        adoZnjRS.Update
        On Error GoTo 0
        
        Me.txtZNJ.Text = 0#
        Me.txtComment.Text = ""
    Else
        Me.txtZNJ.Text = adoZnjRS.Fields("FineRule")
        Me.txtComment.Text = adoZnjRS.Fields("Comment")
    End If
        
    adoZnjRS.Close
    Set adoZnjRS = Nothing
    Exit Sub

ErrHandleOpen:
    Call Warning("滞纳金记录集打开失败!" & Chr(13) & Err.Description)
    On Error GoTo 0
    Exit Sub
ErrHandleAdd:
    Call Warning("滞纳金记录集新增失败!" & Chr(13) & Err.Description)
    On Error GoTo 0
    
End Sub

⌨️ 快捷键说明

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