文件名称:商品销售源码
文件大小:212KB
文件格式:DOC
更新时间:2015-07-19 15:54:23
商品销售
VERSION 5.00 Object = "{BDC217C8-ED16-11CD-956C-0000C04E4C0A}#1.1#0"; "TABCTL32.OCX" 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 main_jbxx_kh BackColor = &H00C0C0C0;& BorderStyle = 1 'Fixed Single Caption = "基本信息管理-【客户信息管理】" ClientHeight = 6165 ClientLeft = 1515 ClientTop = 2385 ClientWidth = 9195 Icon = "main_jbxx_kh.frx":0000 LinkTopic = "Form1" MaxButton = 0 'False MinButton = 0 'False ScaleHeight = 6165 ScaleWidth = 9195 StartUpPosition = 1 '所有者中心 Begin VB.Frame Frame3 Caption = "Frame6" Height = 690 Left = -1545 TabIndex = 11 Top = 2115 Visible = 0 'False Width = 2820 Begin MSAdodcLib.Adodc Adodc1 Height = 330 Left = 930 Top = 225 Width = 1590 _ExtentX = 2805 _ExtentY = 582 ConnectMode = 0 CursorLocation = 3 IsolationLevel = -1 ConnectionTimeout= 15 CommandTimeout = 30 CursorType = 3 LockType = 3 CommandType = 1 CursorOptions = 0 CacheSize = 50 MaxRecords = 0 BOFAction = 0 EOFAction = 0 ConnectStringType= 1 Appearance = 1 BackColor = -2147483643 ForeColor = -2147483640 Orientation = 0 Enabled = -1 Connect = "Provider=MSDASQL.1;Persist Security Info=False;User ID=sa;Data Source=XSGL" OLEDBString = "Provider=MSDASQL.1;Persist Security Info=False;User ID=sa;Data Source=XSGL" OLEDBFile = "" DataSourceName = "" OtherAttributes = "" UserName = "" Password = "" RecordSource = "select * from 客户信息表" 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 End Begin VB.Frame Frame4 BackColor = &H80000004;& Caption = "请选择查询条件" Height = 660 Left = 105 TabIndex = 6 Top = 15 Width = 8970 Begin VB.ComboBox Combo1 Height = 300 ItemData = "main_jbxx_kh.frx":000C Left = 120 List = "main_jbxx_kh.frx":000E Style = 2 'Dropdown List TabIndex = 9 Top = 225 Width = 2580 End Begin VB.CommandButton CmdFind Caption = "查询" Height = 330 Left = 7170 TabIndex = 8 Top = 225 Width = 1710 End Begin VB.TextBox Text1 Height = 300 Left = 2715 TabIndex = 7 Top = 225 Width = 4380 End End Begin TabDlg.SSTab SSTab1 Height = 4785 Left = 90 TabIndex = 12 Top = 690 Width = 9030 _ExtentX = 15928 _ExtentY = 8440 _Version = 393216 Style = 1 Tabs = 2 TabsPerRow = 2 TabHeight = 520 BackColor = 12632256 TabCaption(0) = "客户基本信息" TabPicture(0) = "main_jbxx_kh.frx":0010 Tab(0).ControlEnabled= -1 'True Tab(0).Control(0)= "Frame1" Tab(0).Control(0).Enabled= 0 'False Tab(0).ControlCount= 1 TabCaption(1) = "客户列表" TabPicture(1) = "main_jbxx_kh.frx":002C Tab(1).ControlEnabled= 0 'False Tab(1).Control(0)= "DataGrid1" Tab(1).ControlCount= 1 Begin MSDataGridLib.DataGrid DataGrid1 Bindings = "main_jbxx_kh.frx":0048 Height = 4215 Left = -74910 TabIndex = 34 Top = 420 Width = 8820 _ExtentX = 15558 _ExtentY = 7435 _Version = 393216 AllowUpdate = 0 'False HeadLines = 1 RowHeight = 15 FormatLocked = -1 'True 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 = 16 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 BeginProperty Column02 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 Column03 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 Column04 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 Column05 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 Column06 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 Column07 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 Column08 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 Column09 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 Column10 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 Column11 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 Column12 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 Column13 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 Column14 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 Column15 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 BeginProperty Column00 ColumnWidth = 810.142 EndProperty BeginProperty Column01 ColumnWidth = 2085.166 EndProperty BeginProperty Column02 ColumnWidth = 494.929 EndProperty BeginProperty Column03 ColumnWidth = 1184.882 EndProperty BeginProperty Column04 ColumnWidth = 780.095 EndProperty BeginProperty Column05 ColumnWidth = 764.787 EndProperty BeginProperty Column06 ColumnWidth = 720 EndProperty BeginProperty Column07 ColumnWidth = 555.024 EndProperty BeginProperty Column08 ColumnWidth = 585.071 EndProperty BeginProperty Column09 ColumnWidth = 1005.165 EndProperty BeginProperty Column10 ColumnWidth = 810.142 EndProperty BeginProperty Column11 ColumnWidth = 810.142 EndProperty BeginProperty Column12 ColumnWidth = 1035.213 EndProperty BeginProperty Column13 ColumnWidth = 794.835 EndProperty BeginProperty Column14 ColumnWidth = 794.835 EndProperty BeginProperty Column15 ColumnWidth = 989.858 EndProperty EndProperty End Begin VB.Frame Frame1 Height = 4380 Left = 75 TabIndex = 13 Top = 315 Width = 8865 Begin VB.TextBox kh Appearance = 0 'Flat Enabled = 0 'False BeginProperty Font Name = "宋体" Size = 10.5 Charset = 134 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 315 Index = 15 Left = 5100 TabIndex = 41 Text = "0.00" Top = 3960 Width = 3615 End Begin VB.TextBox kh Appearance = 0 'Flat Enabled = 0 'False BeginProperty Font Name = "宋体" Size = 10.5 Charset = 134 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 315 Index = 14 Left = 1350 TabIndex = 40 Text = "0.00" Top = 3960 Width = 2550 End Begin VB.TextBox kh Appearance = 0 'Flat Enabled = 0 'False BeginProperty Font Name = "宋体" Size = 10.5 Charset = 134 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 315 Index = 10 Left = 1350 TabIndex = 27 Top = 3105 Width = 4125 End Begin VB.TextBox kh Appearance = 0 'Flat Enabled = 0 'False BeginProperty Font Name = "宋体" Size = 10.5 Charset = 134 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 315 Index = 11 Left = 6735 TabIndex = 26 Top = 3105 Width = 1965 End Begin VB.TextBox kh Appearance = 0 'Flat Enabled = 0 'False BeginProperty Font Name = "宋体" Size = 10.5 Charset = 134 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 315 Index = 12 Left = 1350 TabIndex = 25 Top = 3540 Width = 2550 End Begin VB.TextBox kh Appearance = 0 'Flat Enabled = 0 'False BeginProperty Font Name = "宋体" Size = 10.5 Charset = 134 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 315 Index = 13 Left = 5100 TabIndex = 24 Top = 3540 Width = 3615 End Begin VB.TextBox kh Appearance = 0 'Flat Enabled = 0 'False BeginProperty Font Name = "宋体" Size = 10.5 Charset = 134 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 270 Index = 9 Left = 6735 TabIndex = 23 Top = 2745 Width = 1965 End Begin VB.TextBox kh Appearance = 0 'Flat Enabled = 0 'False BeginProperty Font Name = "宋体" Size = 10.5 Charset = 134 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 270 Index = 7 Left = 6735 TabIndex = 22 Top = 2325 Width = 1950 End Begin VB.TextBox kh Appearance = 0 'Flat Enabled = 0 'False BeginProperty Font Name = "宋体" Size = 10.5 Charset = 134 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 315 Index = 8 Left = 1335 TabIndex = 21 Top = 2670 Width = 4185 End Begin VB.TextBox kh Appearance = 0 'Flat Enabled = 0 'False BeginProperty Font Name = "宋体" Size = 10.5 Charset = 134 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 285 Index = 5 Left = 6750 TabIndex = 20 Top = 1860 Width = 1950 End Begin VB.TextBox kh Appearance = 0 'Flat Enabled = 0 'False BeginProperty Font Name = "宋体" Size = 10.5 Charset = 134 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 315 Index = 6 Left = 1335 TabIndex = 19 Top = 2280 Width = 4185 End Begin VB.TextBox kh Appearance = 0 'Flat Enabled = 0 'False BeginProperty Font Name = "宋体" Size = 10.5 Charset = 134 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 315 Index = 4 Left = 1350 TabIndex = 18 Top = 1845 Width = 4185 End Begin VB.TextBox kh Appearance = 0 'Flat Enabled = 0 'False BeginProperty Font Name = "宋体" Size = 10.5 Charset = 134 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 315 Index = 3 Left = 1350 TabIndex = 17 Top = 1455 Width = 7350 End Begin VB.TextBox kh Appearance = 0 'Flat Enabled = 0 'False BeginProperty Font Name = "宋体" Size = 10.5 Charset = 134 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 315 Index = 2 Left = 1350 TabIndex = 16 Top = 1020 Width = 7350 End Begin VB.TextBox kh Appearance = 0 'Flat Enabled = 0 'False BeginProperty Font Name = "宋体" Size = 10.5 Charset = 134 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 315 Index = 1 Left = 1350 TabIndex = 15 Top = 585 Width = 7350 End Begin VB.TextBox kh Appearance = 0 'Flat Enabled = 0 'False BeginProperty Font Name = "宋体" Size = 10.5 Charset = 134 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 315 Index = 0 Left = 1350 TabIndex = 14 Top = 165 Width = 7335 End Begin VB.Label Label7 Caption = "应收金额: 实际欠款:" BeginProperty Font Name = "宋体" Size = 10.5 Charset = 134 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 255 Left = 195 TabIndex = 39 Top = 4050 Width = 6075 End Begin VB.Label Label5 Caption = "开户银行: 银行账号: " BeginProperty Font Name = "宋体" Size = 10.5 Charset = 134 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 330 Left = 195 TabIndex = 33 Top = 3135 Width = 6510 End Begin VB.Label Label6 Caption = "纳税人登记: 网址邮箱:" BeginProperty Font Name = "宋体" Size = 10.5 Charset = 134 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 255 Left = 195 TabIndex = 32 Top = 3570 Width = 6075 End Begin VB.Label Label2 Caption = "联系人:" BeginProperty Font Name = "宋体" Size = 10.5 Charset = 134 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 255 Left = 195 TabIndex = 31 Top = 2685 Width = 1185 End Begin VB.Label Label4 BackStyle = 0 'Transparent Caption = "传真: 联系人电话:" BeginProperty Font Name = "宋体" Size = 10.5 Charset = 134 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 690 Left = 5565 TabIndex = 30 Top = 2340 Width = 1260 End Begin VB.Label Label3 Caption = "邮政编码:" BeginProperty Font Name = "宋体" Size = 10.5 Charset = 134 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 270 Left = 5580 TabIndex = 29 Top = 1905 Width = 1020 End Begin VB.Label Label1 Caption = "客户编号: 客户全称: 客户简称: 客户地址: 所属地区: 电话: " BeginProperty Font Name = "宋体" Size = 10.5 Charset = 134 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 2400 Left = 195 TabIndex = 28 Top = 210 Width = 1200 End End End Begin VB.Frame Frame2 BackColor = &H00C0C0C0;& Height = 645 Left = 60 TabIndex = 0 Top = 5475 Width = 9105 Begin VB.CommandButton CmdMD BackColor = &H00FFC0C0;& BeginProperty Font Name = "宋体" Size = 12 Charset = 134 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 360 Index = 3 Left = 2670 Picture = "main_jbxx_kh.frx":005D Style = 1 'Graphical TabIndex = 38 Top = 195 Width = 800 End Begin VB.CommandButton CmdMD BackColor = &H00FFC0C0;& BeginProperty Font Name = "宋体" Size = 12 Charset = 134 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 360 Index = 2 Left = 1860 Picture = "main_jbxx_kh.frx":160A Style = 1 'Graphical TabIndex = 37 Top = 195 Width = 800 End Begin VB.CommandButton CmdMD BackColor = &H00FFC0C0;& BeginProperty Font Name = "宋体" Size = 12 Charset = 134 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 360 Index = 1 Left = 1065 Picture = "main_jbxx_kh.frx":2B0E Style = 1 'Graphical TabIndex = 36 Top = 195 Width = 800 End Begin VB.CommandButton CmdMD BackColor = &H00FFC0C0;& BeginProperty Font Name = "宋体" Size = 12 Charset = 134 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 360 Index = 0 Left = 270 Picture = "main_jbxx_kh.frx":4040 Style = 1 'Graphical TabIndex = 35 Top = 195 Width = 800 End Begin VB.CommandButton CmdModify BackColor = &H00C0C0C0;& Caption = "[M]修改" Height = 360 Left = 5025 Style = 1 'Graphical TabIndex = 5 Top = 195 Width = 800 End Begin VB.CommandButton CmdExit BackColor = &H00C0C0C0;& Caption = "[X]退出" Height = 360 Left = 8205 Style = 1 'Graphical TabIndex = 4 Top = 195 Width = 800 End Begin VB.CommandButton CmdEsc BackColor = &H00C0C0C0;& Caption = "[E]取消" Height = 360 Left = 7410 Style = 1 'Graphical TabIndex = 3 Top = 195 Width = 800 End Begin VB.CommandButton CmdDelete BackColor = &H00C0C0C0;& Caption = "[D]删除" Height = 360 Left = 5820 Style = 1 'Graphical TabIndex = 2 Top = 195 Width = 800 End Begin VB.CommandButton CmdAdd BackColor = &H00C0C0C0;& Caption = "[A]添加" Height = 360 Left = 4215 Style = 1 'Graphical TabIndex = 1 Top = 195 Width = 800 End Begin VB.CommandButton CmdSave BackColor = &H00C0C0C0;& Caption = "[S]保存" Enabled = 0 'False Height = 360 Left = 6615 Style = 1 'Graphical TabIndex = 10 Top = 195 Width = 800 End End End Attribute VB_Name = "main_jbxx_kh" Attribute VB_GlobalNameSpace = False Attribute VB_Creatable = False Attribute VB_PredeclaredId = True Attribute VB_Exposed = False Dim i As Integer '定义整型变量 Dim rs1 As New ADODB.Recordset '定义数据集对象 Public Sub view_data() '定义显示数据的函数 For i = 0 To 13 If Adodc1.Recordset.RecordCount > 0 Then kh(i).Text = Adodc1.Recordset.Fields(i) Else kh(i).Text = "" Next i End Sub Private Sub Form_Activate() '向combo1中添加查询项目列表 Combo1.AddItem ("客户编号") Combo1.AddItem ("客户全称") Combo1.ListIndex = 1 '打开客户信息表 rs1.Open "select * from 客户信息表 order by 客户编号", Cnn, adOpenKeyset, adLockOptimistic If rs1.RecordCount > 0 Then For i = 0 To 13 If rs1.Fields(i) <> "" Then kh(i).Text = rs1.Fields(i) Next i End If rs1.Close '关闭数据集对象 End Sub Private Sub Form_Unload(Cancel As Integer) frm_main.Enabled = True End Sub Private Sub kh_KeyDown(Index As Integer, KeyCode As Integer, Shift As Integer) If KeyCode = vbKeyReturn And Index < 13 Then kh(Index + 1).SetFocus '回车获得焦点 If KeyCode = vbKeyReturn And Index = 13 Then CmdSave.SetFocus If KeyCode = vbKeyUp And Index > 1 Then kh(Index - 1).SetFocus End Sub Private Sub SSTab1_Click(PreviousTab As Integer) If Adodc1.Recordset.RecordCount > 0 Then If SSTab1.Tab = 1 And CmdAdd.Enabled = False Then MsgBox ("您正在处理数据,请取消数据处理,在执行本操作!") SSTab1.Tab = 0 End If End If End Sub Private Sub CmdFind_Click() '查询客户信息 Adodc1.RecordSource = "select * from 客户信息表 where (客户信息表." & Combo1.Text & " like + '" + Text1.Text + "'+'%')" Adodc1.Refresh Call view_data '调用函数 SSTab1.Tab = 1 End Sub Private Sub CmdMD_Click(Index As Integer) Select Case Index Case Is = 0 '移到第一条记录 If Not Adodc1.Recordset.BOF Then Adodc1.Recordset.MoveFirst Case Is = 1 '移到上一条记录 If Adodc1.Recordset.RecordCount > 0 Then If Adodc1.Recordset.BOF = False Then Adodc1.Recordset.MovePrevious If Adodc1.Recordset.BOF = True Then Adodc1.Recordset.MoveFirst End If Case Is = 2 '移到下一条记录 If Adodc1.Recordset.RecordCount > 0 Then If Adodc1.Recordset.EOF = False Then Adodc1.Recordset.MoveNext If Adodc1.Recordset.EOF = True Then Adodc1.Recordset.MoveLast End If Case Is = 3 '移到最后一条记录 If Adodc1.Recordset.EOF = False Then Adodc1.Recordset.MoveLast End Select Call view_data '调用函数 End Sub Private Sub CmdAdd_Click() '自动创建客户编号 Dim bh As Integer rs1.Open "select * from 客户信息表 order by 客户编号", Cnn, adOpenKeyset, adLockOptimistic If rs1.RecordCount > 0 Then If Not rs1.EOF Then rs1.MoveLast If rs1.Fields("客户编号") <> "" Then bh = Right(Trim(rs1.Fields("客户编号")), 4) + 1 kh(0).Text = "kh" & Format(bh, "0000") End If Else kh(0).Text = "kh0001" End If rs1.Close '关闭数据集对象 For i = 1 To 13 kh(i).Enabled = True kh(i).Text = "" Next i '设置控件状态 CmdSave.Enabled = True: CmdEsc.Enabled = True: CmdAdd.Enabled = False CmdModify.Enabled = False: CmdDelete.Enabled = False For i = 0 To 3 CmdMD(i).Enabled = False Next i SSTab1.Tab = 0 kh(1).SetFocus End Sub Private Sub CmdModify_Click() '允许用户修改 If Adodc1.Recordset.RecordCount > 0 Then For i = 0 To 13 kh(i).Enabled = True Next i CmdSave.Enabled = True: CmdEsc.Enabled = True: CmdAdd.Enabled = False CmdModify.Enabled = False: CmdDelete.Enabled = False For i = 0 To 3 CmdMD(i).Enabled = False Next i Else MsgBox ("没有要修改的数据!") End If End Sub Private Sub CmdDelete_Click() '删除客户信息 If Adodc1.Recordset.RecordCount > 0 Then a = MsgBox("您确实要删除这条数据吗?", vbYesNo) If a = vbYes Then '打开错误处理程序 On Error GoTo ErrorHandler Adodc1.Recordset.Delete Adodc1.Refresh For i = 0 To 13 If Adodc1.Recordset.Fields(i) <> "" Then kh(i).Text = Adodc1.Recordset.Fields(i) Next i CmdSave.Enabled = False: CmdEsc.Enabled = False: CmdAdd.Enabled = True CmdModify.Enabled = True: CmdDelete.Enabled = True For i = 0 To 3 CmdMD(i).Enabled = True Next i End If Exit Sub '退出程序,以避免进入错误处理程序 ErrorHandler: '错误处理程序 If Err.Number = -2147217900 Then MsgBox "此客户与商家已存在往来关系,系统不允许删除!" Resume Next '从紧随产生错误的语句的下个语句恢复运行 End If End If End Sub Private Sub CmdSave_Click() '保存客户信息 rs1.Open "select * from 客户信息表 where 客户编号='" & Trim(kh(0).Text) & "'order by 客户编号", Cnn, adOpenKeyset, adLockOptimistic If rs1.RecordCount > 0 Then Dim a As String a = MsgBox("您确实要修改这条数据吗?", vbYesNo) If a = vbYes Then For i = 1 To 13 If kh(1).Text <> "" Then rs1.Fields(i) = Trim(kh(i).Text) kh(i).Enabled = False Next i rs1.Update Adodc1.Refresh End If Else If kh(1).Text <> "" And kh(2).Text <> "" Then '添加客户信息 rs1.AddNew For i = 0 To 13 rs1.Fields(i) = Trim(kh(i).Text) kh(i).Enabled = False Next i rs1.Update '更新数据库 Adodc1.Refresh Else MsgBox "请填写完整的信息" End If End If rs1.Close '关闭数据集对象 '设置控件状态 CmdSave.Enabled = False: CmdEsc.Enabled = False: CmdAdd.Enabled = True CmdModify.Enabled = True: CmdDelete.Enabled = True For i = 0 To 3 CmdMD(i).Enabled = True Next i End Sub Private Sub CmdEsc_Click() '取消操作 rs1.Open "select * from 客户信息表 order by 客户编号", Cnn, adOpenKeyset, adLockOptimistic If rs1.RecordCount > 0 Then For i = 0 To 13 If rs1.Fields(i) <> "" Then kh(i).Text = rs1.Fields(i) '赋值给kh(i) kh(i).Enabled = False Next i End If