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

📄 frmcustomer.frm

📁 物业管理信息系统my sql +visual basic
💻 FRM
📖 第 1 页 / 共 2 页
字号:
         Name            =   "宋体"
         Size            =   10.5
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   105
      TabIndex        =   16
      Top             =   3195
      Width           =   1095
   End
   Begin VB.Label Label5 
      Alignment       =   2  'Center
      Caption         =   "电话:"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   10.5
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   255
      Left            =   4140
      TabIndex        =   15
      Top             =   600
      Width           =   1215
   End
   Begin VB.Label Label4 
      Alignment       =   2  'Center
      Caption         =   "联系地址:"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   10.5
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   255
      Left            =   270
      TabIndex        =   14
      Top             =   1365
      Width           =   1410
   End
   Begin VB.Label Label2 
      Alignment       =   2  'Center
      Caption         =   "住户姓名:"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   10.5
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   255
      Left            =   390
      TabIndex        =   13
      Top             =   645
      Width           =   1365
   End
End
Attribute VB_Name = "frmCustomer"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim mrc As ADODB.Recordset
Dim myBookmark As Variant
Dim mcclean As Boolean


Private Sub cancelCommand_Click()
 Unload Me
End Sub

Private Sub cmdAdd_Click()
ModifyFlag = False
 mcclean = False
    Frame2.Enabled = False
    firstCommand.Enabled = False
    previousCommand.Enabled = False
    nextCommand.Enabled = False
    lastCommand.Enabled = False
    txtCustomerNO.Enabled = True
    txtName.Enabled = True
    txtPhone.Enabled = True
    TxtAddress.Enabled = True
    txtComment.Enabled = True
    txtPrePay.Enabled = True
    txtUnPay.Enabled = True
    txtCustomerNO.Text = ""
    txtName.Text = ""
    txtPhone.Text = ""
    TxtAddress.Text = ""
    txtComment.Text = ""
     txtPrePay.Text = ""
    txtUnPay.Text = ""
    myBookmark = mrc.Bookmark
End Sub

Private Sub deleteCommand_Click()
  myBookmark = mrc.Bookmark
    
    If MsgBox("是否删除当前记录?", vbOKCancel, "删除当前记录") = vbOK Then
            mrc.MoveNext
            If mrc.EOF Then
                mrc.MoveFirst
                myBookmark = mrc.Bookmark
                mrc.MoveLast
                mrc.Delete
                mrc.Bookmark = myBookmark
                Call viewData
            Else
                myBookmark = mrc.Bookmark
                mrc.MovePrevious
                mrc.Delete
                mrc.Bookmark = myBookmark
                Call viewData
            End If
    Else
        mrc.Bookmark = myBookmark
        Call viewData
    End If
End Sub

Private Sub editCommand_Click()
ModifyFlag = True
 mcclean = False
    Frame2.Enabled = False
    firstCommand.Enabled = False
    previousCommand.Enabled = False
    nextCommand.Enabled = False
    lastCommand.Enabled = False
    txtName.Enabled = True
    txtPhone.Enabled = True
    TxtAddress.Enabled = True
    txtComment.Enabled = True
    txtPrePay.Enabled = True
    txtUnPay.Enabled = True
    myBookmark = mrc.Bookmark
End Sub

Private Sub firstCommand_Click()
   mrc.MoveFirst
    Call viewData
End Sub

Private Sub Form_Load()
ModifyFlag = True
    UserName = "dfa"
     
    Dim txtSQL As String
    Dim MsgText As String
    
    txtSQL = "select * from Customer"
    Set mrc = ExecuteSQL(txtSQL, MsgText)
    
    
    
    mrc.MoveFirst
    Call viewData
    myBookmark = mrc.Bookmark
    mcclean = True
    
    
    
    
End Sub

Public Sub viewData()
    txtCustomerNO.Text = mrc.Fields(0)
    txtName.Text = mrc.Fields(1)
    txtPhone.Text = mrc.Fields(2)
    TxtAddress.Text = mrc.Fields(3)
    txtComment.Text = mrc.Fields(4)
    txtPrePay.Text = mrc.Fields(5)
    txtUnPay.Text = mrc.Fields(6)
    txtModifyName.Text = mrc.Fields(7)
    txtModifyDate.Text = mrc.Fields(8)
   
End Sub

Private Sub Label2_Click()

End Sub

Private Sub lastCommand_Click()
 mrc.MoveLast
    Call viewData
End Sub

Private Sub nextCommand_Click()
 mrc.MoveNext
    If mrc.EOF Then
        mrc.MoveFirst
    End If
    Call viewData
End Sub

Private Sub previousCommand_Click()
 mrc.MovePrevious
    If mrc.BOF Then
        mrc.MoveLast
    End If
    Call viewData
End Sub

Private Sub Text3_Change()

End Sub

Private Sub txtModifyName_Change()

End Sub

Private Sub txtName_Change()

End Sub

Private Sub txtPrePay_Change()
End Sub

Private Sub updateCommand_Click()
 Dim txtSQL As String
    Dim MsgText As String
    Dim mrcc As ADODB.Recordset
    
    If mcclean Then
        MsgBox "请先修改住户资料信息信息", vbOKOnly + vbExclamation, "警告"
        Exit Sub
    End If
    
    If Not Testtxt(txtCustomerNO.Text) Then
        MsgBox "请输入住户编号!", vbOKOnly + vbExclamation, "警告"
        txtCustomerNO.SetFocus
        Exit Sub
    End If
    
    If Not Testtxt(txtName.Text) Then
        MsgBox "请输入住户名称!", vbOKOnly + vbExclamation, "警告"
        txtName.SetFocus
        Exit Sub
    End If
     If Not Testtxt(txtPhone.Text) Then
        MsgBox "请输入电话!", vbOKOnly + vbExclamation, "警告"
        txtName.SetFocus
        Exit Sub
    End If
     If Not Testtxt(TxtAddress.Text) Then
        MsgBox "请输入联系地址!", vbOKOnly + vbExclamation, "警告"
        txtName.SetFocus
        Exit Sub
    End If
    If Not IsNumeric(txtPrePay.Text) Then
        MsgBox "请输入预付款!", vbOKOnly + vbExclamation, "警告"
        txtPhone.SetFocus
        Exit Sub
    End If
    
    If Not IsNumeric(txtUnPay.Text) Then
        MsgBox "请输入欠款!", vbOKOnly + vbExclamation, "警告"
        TxtAddress.SetFocus
        Exit Sub
    End If
    
     If ModifyFlag = True Then
     
    mrc.Delete
    End If
    txtSQL = "select * from Customer where CustomerNO = '" & Trim(txtCustomerNO.Text) & "'"
    Set mrcc = ExecuteSQL(txtSQL, MsgText)
    If mrcc.EOF = False Then
        MsgBox "学号重复,请重新输入!", vbOKOnly + vbExclamation, "警告"
        mrcc.Close
        txtCustomerNO.SetFocus
    Else
        mrcc.Close
       
                                           
                mrc.AddNew
                mrc.Fields(0) = Trim(txtCustomerNO.Text)
                mrc.Fields(1) = Trim(txtName.Text)
                mrc.Fields(2) = Trim(txtPhone.Text)
                mrc.Fields(3) = Trim(TxtAddress.Text)
                mrc.Fields(4) = Trim(txtComment.Text)
                mrc.Fields(5) = Trim(txtPrePay.Text)
                mrc.Fields(6) = Trim(txtUnPay.Text)
                mrc.Fields(7) = UserName
                mrc.Fields(8) = CStr(Date)
               
                 
                mrc.Update
                MsgBox "住户资料信息更新成功!", vbOKOnly + vbExclamation, "住户资料信息信息更新"
                mrc.Bookmark = myBookmark
                Call viewData
                Frame2.Enabled = True
                firstCommand.Enabled = True
                previousCommand.Enabled = True
                nextCommand.Enabled = True
                lastCommand.Enabled = True
        
                txtCustomerNO.Enabled = False
                txtName.Enabled = False
                txtPhone.Enabled = False
                TxtAddress.Enabled = False
                 txtPrePay.Enabled = False
    txtUnPay.Enabled = False
                
                mcclean = True
                            
                
            End If
     
    
End Sub

⌨️ 快捷键说明

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