?? frmcustomer2.frm
字號:
VERSION 5.00
Begin VB.Form frmCustomer2
Caption = "客戶信息查詢"
ClientHeight = 1548
ClientLeft = 48
ClientTop = 348
ClientWidth = 3744
LinkTopic = "Form1"
ScaleHeight = 1548
ScaleWidth = 3744
StartUpPosition = 1 'CenterOwner
Begin VB.ComboBox Combo1
Height = 288
Index = 1
Left = 1440
Style = 2 'Dropdown List
TabIndex = 8
Top = 480
Width = 2172
End
Begin VB.TextBox txtNo
Height = 270
Left = 120
TabIndex = 7
TabStop = 0 'False
Top = 1920
Visible = 0 'False
Width = 735
End
Begin VB.CheckBox chkItem
Caption = "Check1"
Height = 180
Index = 1
Left = 120
TabIndex = 4
TabStop = 0 'False
Top = 480
Width = 132
End
Begin VB.ComboBox Combo1
Height = 288
Index = 0
Left = 1440
Style = 2 'Dropdown List
TabIndex = 3
Top = 120
Width = 2172
End
Begin VB.CheckBox chkItem
Caption = "Check1"
Height = 180
Index = 0
Left = 120
TabIndex = 2
TabStop = 0 'False
Top = 120
Value = 1 'Checked
Width = 132
End
Begin VB.CommandButton cmdOk
Caption = "確定 (&O)"
Default = -1 'True
Height = 375
Left = 600
TabIndex = 1
Top = 1080
Width = 1215
End
Begin VB.CommandButton cmdExit
Caption = "取消 (&X)"
Height = 375
Left = 2160
TabIndex = 0
Top = 1080
Width = 1215
End
Begin VB.Label lblitem
Caption = "客戶類型:"
Height = 252
Index = 1
Left = 480
TabIndex = 6
Top = 480
Width = 1092
End
Begin VB.Label lblitem
Caption = "客戶姓名:"
Height = 252
Index = 0
Left = 480
TabIndex = 5
Top = 120
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
Combo1(0).SetFocus
Else
Combo1(1).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 = " customerName = '" & Trim(Combo1(0) & " ") & "'"
End If
If chkItem(1).Value = vbChecked Then
If Trim(sQSql & " ") = "" Then
sQSql = " customerType ='" & Trim(Combo1(1) & " ") & "'"
Else
sQSql = sQSql & " and customerType ='" & Trim(Combo1(1) & " ") & "'"
End If
End If
If Trim(sQSql) = "" Then
MsgBox "請設置查詢條件!", vbOKOnly + vbExclamation, "警告"
Me.Hide
Exit Sub
Else
frmCustomer.txtSQL = "select * from customerInfo where" & sQSql
Me.Hide
Unload frmCustomer
frmCustomer.Show
End If
End Sub
Private Sub Form_Load()
Dim i As Integer
Dim sSql As String
Dim txtSQL As String
Dim MsgText As String
Dim mrc As ADODB.Recordset
For i = 0 To 1
Combo1(i).Clear
Next i
txtSQL = "select DISTINCT customerName from customerInfo"
Set mrc = ExecuteSQL(txtSQL, MsgText)
If Not mrc.EOF Then
Do While Not mrc.EOF
Combo1(0).AddItem Trim(mrc.Fields(0))
mrc.MoveNext
Loop
Else
MsgBox "請先進行客戶信息設置!", vbOKOnly + vbExclamation, "警告"
Exit Sub
End If
mrc.Close
txtSQL = "select DISTINCT customerType from customerInfo"
Set mrc = ExecuteSQL(txtSQL, MsgText)
If Not mrc.EOF Then
Do While Not mrc.EOF
Combo1(1).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 + -