?? frmcustslt.frm
字號:
VERSION 5.00
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Object = "{CDE57A40-8B86-11D0-B3C6-00A0C90AEA82}#1.0#0"; "MSDATGRD.OCX"
Begin VB.Form FrmCustSlt
Caption = "選擇客戶"
ClientHeight = 6105
ClientLeft = 60
ClientTop = 450
ClientWidth = 9900
LinkTopic = "Form5"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 6105
ScaleWidth = 9900
StartUpPosition = 3 '窗口缺省
Begin VB.Frame Frame1
Height = 615
Left = 0
TabIndex = 1
Top = 120
Width = 9855
Begin VB.ComboBox ComboType
Height = 300
ItemData = "FrmCustSlt.frx":0000
Left = 1320
List = "FrmCustSlt.frx":0002
Style = 2 'Dropdown List
TabIndex = 2
Top = 180
Width = 1335
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "客戶類別"
Height = 180
Left = 240
TabIndex = 3
Top = 240
Width = 720
End
End
Begin MSAdodcLib.Adodc Adodc1
Height = 330
Left = 6840
Top = 0
Visible = 0 'False
Width = 1815
_ExtentX = 3201
_ExtentY = 582
ConnectMode = 0
CursorLocation = 3
IsolationLevel = -1
ConnectionTimeout= 15
CommandTimeout = 30
CursorType = 3
LockType = 3
CommandType = 8
CursorOptions = 0
CacheSize = 50
MaxRecords = 0
BOFAction = 0
EOFAction = 0
ConnectStringType= 1
Appearance = 1
BackColor = -2147483643
ForeColor = -2147483640
Orientation = 0
Enabled = -1
Connect = ""
OLEDBString = ""
OLEDBFile = ""
DataSourceName = ""
OtherAttributes = ""
UserName = ""
Password = ""
RecordSource = ""
Caption = "Adodc1"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋體"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
_Version = 393216
End
Begin MSDataGridLib.DataGrid DataGrid1
Height = 4695
Left = 0
TabIndex = 0
Top = 840
Width = 9855
_ExtentX = 17383
_ExtentY = 8281
_Version = 393216
AllowUpdate = 0 'False
HeadLines = 1
RowHeight = 15
BeginProperty HeadFont {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋體"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋體"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ColumnCount = 2
BeginProperty Column00
DataField = ""
Caption = ""
BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED}
Type = 0
Format = ""
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 2052
SubFormatType = 0
EndProperty
EndProperty
BeginProperty Column01
DataField = ""
Caption = ""
BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED}
Type = 0
Format = ""
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 2052
SubFormatType = 0
EndProperty
EndProperty
SplitCount = 1
BeginProperty Split0
MarqueeStyle = 3
BeginProperty Column00
EndProperty
BeginProperty Column01
EndProperty
EndProperty
End
End
Attribute VB_Name = "FrmCustSlt"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim OriType As String
Public TmpCustId As String
Public TmpCustName As String
Public TmpCustType As String
Private Sub Loadtype()
Dim i As Integer
i = 0
'讀取客戶類別到數組Arr_CustType()中
MyCust.Loadtype
ComboType.Clear
'依次把數組Arr_CustType()中的數據添加到ComboType組合框中
i = 0
Do While Arr_CustType(i) <> ""
ComboType.AddItem Arr_CustType(i)
i = i + 1
Loop
'設置ComboType的顯示值
If OriType = "" Then
If ComboType.ListCount > 0 Then
ComboType.ListIndex = 0
End If
Else
If InCombo(OriType, ComboType) = True Then
ComboType.Text = OriType
Else
If ComboType.ListCount > 0 Then
ComboType.ListIndex = 0
End If
End If
End If
End Sub
Private Sub Refresh_Customer()
Dim TmpSource As String '保存SQL語句的變量
'設置查詢語句,WHERE CustType='" + Trim(ComboType.Text) + "'"
'表示根據當前選擇的客戶類別選擇客戶記錄
TmpSource = "SELECT Idtype As 證件類型, CustId As 證件編號, CustName As 客戶姓名," _
+ "CustType as 客戶類型, OrgName As 客戶單位, CustLevel As 客戶等級," _
+ " Office As 單位電話, Mobile As 移動電話 " _
+ " FROM Customer WHERE CustType='" + Trim(ComboType.Text) + "'"
'設置ADO控件的數據源
Adodc1.ConnectionString = Conn
Adodc1.RecordSource = TmpSource
Adodc1.Refresh
Set DataGrid1.DataSource = Adodc1
DataGrid1.Columns(0).Width = 1000 '證件類型
DataGrid1.Columns(1).Width = 1000 '證件編號
DataGrid1.Columns(2).Width = 1000 '客戶姓名
DataGrid1.Columns(3).Width = 1000 '客戶類型
DataGrid1.Columns(4).Width = 1600 '客戶單位
DataGrid1.Columns(5).Width = 1000 '客戶等級
DataGrid1.Columns(6).Width = 1000 '單位電話
DataGrid1.Columns(7).Width = 1000 '移動電話
End Sub
Private Sub ComboType_Click()
Refresh_Customer
End Sub
Private Sub DataGrid1_DblClick()
'將選擇客戶信息保存在公共變量中
TmpCustId = Trim(Adodc1.Recordset.Fields(1))
TmpCustName = Trim(Adodc1.Recordset.Fields(2))
TmpCustType = Trim(Adodc1.Recordset.Fields(3))
Unload Me
End Sub
Private Sub Form_Load()
'裝入客戶類別數據
Loadtype
'設置數據源的查詢條件,并刷新顯示
Refresh_Customer
End Sub
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -