📄 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 = 5685
ClientLeft = 60
ClientTop = 345
ClientWidth = 10140
Icon = "FrmCustSlt.frx":0000
LinkTopic = "Form1"
ScaleHeight = 5685
ScaleWidth = 10140
StartUpPosition = 2 'CenterScreen
Begin MSAdodcLib.Adodc Adodc1
Height = 330
Left = 7320
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 = 120
TabIndex = 3
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
Begin VB.Frame Frame1
Height = 615
Left = 120
TabIndex = 0
Top = 120
Width = 9855
Begin VB.ComboBox ComboType
Height = 300
ItemData = "FrmCustSlt.frx":0CCA
Left = 1320
List = "FrmCustSlt.frx":0CCC
Style = 2 'Dropdown List
TabIndex = 2
Top = 180
Width = 1335
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "客户类别"
Height = 180
Left = 240
TabIndex = 1
Top = 240
Width = 720
End
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 + -