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

📄 frmcustomer2.frm

📁 一个贸易公司的管理信息系统 我的毕业设计
💻 FRM
字号:
VERSION 5.00
Begin VB.Form frmCustomer2 
   Caption         =   "查询顾客信息"
   ClientHeight    =   2016
   ClientLeft      =   48
   ClientTop       =   348
   ClientWidth     =   3852
   LinkTopic       =   "Form1"
   ScaleHeight     =   2016
   ScaleWidth      =   3852
   StartUpPosition =   1  'CenterOwner
   Begin VB.TextBox txtItem 
      Height          =   270
      Index           =   0
      Left            =   1440
      TabIndex        =   7
      Top             =   120
      Width           =   2172
   End
   Begin VB.CommandButton cmdExit 
      Caption         =   "取消 (&X)"
      Height          =   375
      Left            =   2160
      TabIndex        =   6
      Top             =   1440
      Width           =   1215
   End
   Begin VB.CommandButton cmdOk 
      Caption         =   "确定 (&O)"
      Default         =   -1  'True
      Height          =   375
      Left            =   600
      TabIndex        =   5
      Top             =   1440
      Width           =   1215
   End
   Begin VB.CheckBox chkItem 
      Caption         =   "Check1"
      Height          =   180
      Index           =   0
      Left            =   120
      TabIndex        =   4
      TabStop         =   0   'False
      Top             =   120
      Value           =   1  'Checked
      Width           =   132
   End
   Begin VB.ComboBox Combo1 
      Height          =   288
      Left            =   1440
      Style           =   2  'Dropdown List
      TabIndex        =   3
      Top             =   840
      Width           =   2172
   End
   Begin VB.CheckBox chkItem 
      Caption         =   "Check1"
      Height          =   180
      Index           =   1
      Left            =   120
      TabIndex        =   2
      TabStop         =   0   'False
      Top             =   480
      Width           =   132
   End
   Begin VB.CheckBox chkItem 
      Caption         =   "Check1"
      Height          =   180
      Index           =   2
      Left            =   120
      TabIndex        =   1
      TabStop         =   0   'False
      Top             =   840
      Width           =   132
   End
   Begin VB.TextBox txtItem 
      Height          =   270
      Index           =   1
      Left            =   1440
      TabIndex        =   0
      Top             =   480
      Width           =   2172
   End
   Begin VB.Label lblitem 
      Caption         =   "公司名称:"
      Height          =   252
      Index           =   0
      Left            =   480
      TabIndex        =   10
      Top             =   120
      Width           =   1092
   End
   Begin VB.Label lblitem 
      Caption         =   "所在城市:"
      Height          =   252
      Index           =   1
      Left            =   480
      TabIndex        =   9
      Top             =   840
      Width           =   1092
   End
   Begin VB.Label lblitem 
      Caption         =   "联系人姓名:"
      Height          =   252
      Index           =   2
      Left            =   480
      TabIndex        =   8
      Top             =   480
      Width           =   1092
   End
End
Attribute VB_Name = "frmCustomer2"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private Sub chkItem_Click(Index As Integer)
    If Index = 0 Then
        txtItem(0).SetFocus
    ElseIf Index = 1 Then
        txtItem(1).SetFocus
    Else
        Combo1.SetFocus
    End If
End Sub

Private Sub cmdExit_Click()
    Me.Hide
End Sub

Private Sub cmdOK_Click()
    Dim sQSql As String
    
    
    If chkItem(0).Value = vbChecked Then
        sQSql = " CompanyName = '" & Trim(txtItem(0) & " ") & "'"
    End If
    
    
    If chkItem(1).Value = vbChecked Then
        If Trim(sQSql & " ") = "" Then
            sQSql = " ContactName ='" & Trim(txtItem(1) & " ") & "'"
        Else
            sQSql = sQSql & " and ContactName ='" & Trim(txtItem(1) & " ") & "'"
        End If
    End If
    
    If chkItem(2).Value = vbChecked Then
        If Trim(sQSql & " ") = "" Then
            sQSql = " City ='" & Trim(Combo1 & " ") & "'"
        Else
            sQSql = sQSql & " and City ='" & Trim(Combo1 & " ") & "'"
        End If
    End If
    
    If Trim(sQSql) = "" Then
        MsgBox "请设置查询条件!", vbOKOnly + vbExclamation, "警告"
        Exit Sub
    Else
        If flagCedit Then
            Unload frmCustomer
        End If
        frmCustomer.txtSQL = "select * from customers where" & sQSql
        frmCustomer.Show
    End If
    Me.Hide
End Sub

Private Sub Form_Load()
    
    
    Dim i As Integer
    Dim j As Integer
    Dim sSql As String
    Dim txtSQL As String
    Dim MsgText As String
    Dim mrc As ADODB.Recordset
    
    Combo1.Clear
    txtSQL = "select DISTINCT City from customers"
    Set mrc = ExecuteSQL(txtSQL, MsgText)
        
    If Not mrc.EOF Then
            
        Do While Not mrc.EOF
            Combo1.AddItem Trim(mrc.Fields(0))
            mrc.MoveNext
        Loop
        
            
    Else
        MsgBox "请先进行供应商设置!", vbOKOnly + vbExclamation, "警告"
        Exit Sub
    End If
    mrc.Close
End Sub

Private Sub lblitem_Click(Index As Integer)
    chkItem(Index).Value = vbChecked
    
End Sub

Private Sub txtItem_GotFocus(Index As Integer)
   
    txtItem(Index).SelStart = 0
    txtItem(Index).SelLength = Len(txtItem(Index))
End Sub

⌨️ 快捷键说明

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