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

📄 frmcustomer2.frm

📁 一个简单的用vb制作的公司贸易管理系统
💻 FRM
字号:
VERSION 5.00
Begin VB.Form frmCustomer2 
   BorderStyle     =   1  'Fixed Single
   Caption         =   "查询顾客信息"
   ClientHeight    =   2580
   ClientLeft      =   30
   ClientTop       =   330
   ClientWidth     =   3855
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   2580
   ScaleWidth      =   3855
   StartUpPosition =   1  '所有者中心
   Begin VB.CommandButton Command1 
      Caption         =   "显示所有(&A)"
      Height          =   375
      Left            =   1320
      TabIndex        =   11
      Top             =   2040
      Width           =   1215
   End
   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 
      AutoSize        =   -1  'True
      Caption         =   "公司名称:"
      Height          =   180
      Index           =   0
      Left            =   480
      TabIndex        =   10
      Top             =   120
      Width           =   900
   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()

    Unload Me

End Sub

Private Sub cmdOK_Click()
    Dim sQSql As String

    If chkItem(0).Value = vbChecked Then
        sQSql = " cn_CompanyName = '" & Trim(txtItem(0) & " ") & "'"
    End If

    If chkItem(1).Value = vbChecked Then
        If Trim(sQSql & " ") = "" Then
            sQSql = " en_CompanyName ='" & Trim(txtItem(1) & " ") & "'"
        Else
            sQSql = sQSql & " and en_CompanyName ='" & 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
    Unload Me

End Sub

Private Sub Command1_Click()
    frmCustomer.txtsql = "select * from customers"
    frmCustomer.Show
    Unload Me

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 + -