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

📄 main增加客户.frm

📁 1. 观察计算机显示系统构成
💻 FRM
📖 第 1 页 / 共 3 页
字号:
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   300
            Left            =   225
            TabIndex        =   21
            Top             =   2970
            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          =   855
            Left            =   5880
            TabIndex        =   20
            Top             =   2610
            Width           =   840
         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            =   5790
            TabIndex        =   19
            Top             =   2145
            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            =   255
            TabIndex        =   18
            Top             =   465
            Width           =   1200
         End
      End
      Begin VB.Label czjl 
         BackStyle       =   0  'Transparent
         Height          =   285
         Left            =   4050
         TabIndex        =   32
         Top             =   -585
         Width           =   4905
      End
   End
End
Attribute VB_Name = "main增加客户"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim i As Integer
Private Sub Combo1_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then
  Combo2.SetFocus
Else
End If
End Sub

Private Sub Combo2_KeyDown(KeyCode As Integer, Shift As Integer)
  If KeyCode = 13 Then
   kh(5).SetFocus
  Else
  End If
End Sub

Private Sub Form_Load()
 On Error Resume Next
DTPicker1.Value = Date
  frm主窗体.StatusBar1.Panels(1) = Me.Caption
'  Data1.DatabaseName = App.Path & "\db2.mdb"
'  Data1.Connect = ";pwd=" & 73322
  Adodc1.RecordSource = "select * from 省份名称"
  Adodc1.Refresh
    If Adodc1.Recordset.RecordCount > 0 Then
       Adodc1.Recordset.MoveFirst
          Do While Adodc1.Recordset.EOF = False
               Combo1.AddItem (Adodc1.Recordset.Fields("省份名称"))
               Adodc1.Recordset.MoveNext
          Loop
    Else
    End If
      Adodc2.RecordSource = "select * from csmc"
      Adodc2.Refresh
    If Adodc2.Recordset.RecordCount > 0 Then
       Adodc2.Recordset.MoveFirst
          Do While Adodc2.Recordset.EOF = False
               Combo2.AddItem (Adodc2.Recordset.Fields("城市名称"))
               Adodc2.Recordset.MoveNext
          Loop
    Else
    End If
End Sub

Private Sub kh_KeyDown(Index As Integer, KeyCode As Integer, Shift As Integer)
 On Error Resume Next
'运用数组
  Select Case Index
    Case 0
      If Index = 0 And KeyCode = vbKeyReturn Then
         kh(1).SetFocus
      End If
      
    Case 1
      If Index = 1 And KeyCode = vbKeyReturn Then
         kh(2).SetFocus
     End If
     If KeyCode = vbKeyUp Then
        kh(1).SetFocus
     End If
     
    Case 2
      If Index = 2 And KeyCode = vbKeyReturn Then
         kh(3).SetFocus
      End If
      If KeyCode = vbKeyUp Then
         kh(1).SetFocus
      End If
      
    Case 3
      If Index = 3 And KeyCode = vbKeyReturn Then
         Combo1.SetFocus
      '   kh(4).SetFocus
      End If
     If KeyCode = vbKeyUp Then
        kh(2).SetFocus
     End If
     
'    Case 4
'      If Index = 4 And KeyCode = vbKeyReturn Then
'         kh(5).SetFocus
'      End If
'      If KeyCode = vbKeyUp Then
'         kh(3).SetFocus
'      End If
      
    Case 5
      If Index = 5 And KeyCode = vbKeyReturn Then
         kh(6).SetFocus
      End If
      If KeyCode = vbKeyUp Then
         kh(4).SetFocus
      End If
      
    Case 6
      If Index = 6 And KeyCode = vbKeyReturn Then
         kh(7).SetFocus
      End If
      If KeyCode = vbKeyUp Then
         kh(5).SetFocus
      End If
      
    Case 7
      If Index = 7 And KeyCode = vbKeyReturn Then
         kh(8).SetFocus
      End If
      If KeyCode = vbKeyUp Then
         kh(6).SetFocus
      End If
      
    Case 8
      If Index = 8 And KeyCode = vbKeyReturn Then
         kh(9).SetFocus
      End If
      If KeyCode = vbKeyUp Then
         kh(7).SetFocus
      End If
      
    Case 9
      If Index = 9 And KeyCode = vbKeyReturn Then
         SSTab1.Tab = 1
         kh(10).SetFocus
      End If
      If KeyCode = vbKeyUp Then
         kh(8).SetFocus
      End If
      
    Case 10
      If Index = 10 And KeyCode = vbKeyReturn Then
         kh(11).SetFocus
      End If
      If KeyCode = vbKeyUp Then
         SSTab1.Tab = 0
         kh(9).SetFocus
      End If
      
    Case 11
      If Index = 11 And KeyCode = vbKeyReturn Then
         kh(12).SetFocus
      End If
      If KeyCode = vbKeyUp Then
         kh(10).SetFocus
      End If
      
    Case 12
      If Index = 12 And KeyCode = vbKeyReturn Then
         kh(13).SetFocus
      End If
      If KeyCode = vbKeyUp Then
         kh(11).SetFocus
      End If
      
    Case 13
      If Index = 13 And KeyCode = vbKeyReturn Then
         kh(14).SetFocus
      End If
      If KeyCode = vbKeyUp Then
         kh(12).SetFocus
      End If
      
    Case 14
      If Index = 14 And KeyCode = vbKeyReturn Then
         kh(15).SetFocus
      End If
      If KeyCode = vbKeyUp Then
         kh(13).SetFocus
      End If
      
    Case 15
      If Index = 15 And KeyCode = vbKeyReturn Then
         kh(16).SetFocus
      End If
      If KeyCode = vbKeyUp Then
         kh(14).SetFocus
      End If
      
    Case 16
      If Index = 16 And KeyCode = vbKeyReturn Then
         ComSave.Enabled = True
         ComSave.SetFocus
      End If
      If KeyCode = vbKeyUp Then
         kh(15).SetFocus
      End If
  End Select
End Sub

Private Sub ComSave_Click()
 On Error Resume Next
 kh(4).Text = Combo1.Text & Combo2.Text
  If kh(0).Text <> "" And kh(1).Text <> "" Then
  Call main
  Dim DWMC, YZBM As String
  Adodc4.RecordSource = "select * from 本单位信息表"
  Adodc4.Refresh
  If Adodc4.Recordset.RecordCount > 0 Then
  DWMC = Adodc4.Recordset.Fields("单位名称")
  YZBM = Adodc4.Recordset.Fields("邮政编码")
  Else
  End If
   Set adoRs = adoCon.Execute("insert into kh values(" & kh(0) & ",'" & kh(1) & "','" & kh(2) & "','" & kh(3) & "','" & kh(4) & "','" & kh(5) & "','" & kh(6) & "','" & kh(7) & "','" & kh(8) & "','" & kh(9) & "','" & kh(10) & "','" & kh(11) & "','" & kh(12) & "','" & kh(13) & "','" & kh(14) & "','" & kh(15) & "','" & kh(16) & "','" & Str(DTPicker1) & "','" & DWMC & "','" & YZBM & "')")
   adoCon.Close
   MsgBox "数据保存成功!", , "保存信息提示"
    ComSave.Enabled = False
    ComCancel.Enabled = False
    ComAdd.Enabled = True
  Else
    MsgBox ("必须输入客户全称")
    SSTab1.Tab = 0
    kh(1).SetFocus
  End If
End Sub
Private Sub ComAdd_Click()
  For i = 0 To 16
      kh(i).Enabled = True
      kh(i).Text = ""
    Adodc1.RecordSource = "select * from 客户信息表 order by 客户编号"
    Adodc1.Refresh
      If Adodc1.Recordset.RecordCount = 0 Then
           kh(0).Text = "00001"
         Else
          If Adodc1.Recordset.RecordCount > 0 Then
          Adodc1.Recordset.MoveLast
           kh(0).Text = Format(Adodc1.Recordset.Fields("客户编号") + 1, "00000")
          Else
          End If
        End If
  Next i
  ComSave.Visible = True
  ComCancel.Enabled = True
  ComAdd.Enabled = False
  SSTab1.Tab = 0
  kh(1).SetFocus
End Sub

Private Sub ComCancel_Click()
 On Error Resume Next
  For i = 0 To 16
      kh(i).Enabled = False
      kh(i).Text = ""
  Next i
  ComSave.Enabled = False
  ComCancel.Enabled = False
  ComAdd.Enabled = True
End Sub

Private Sub Form_Unload(Cancel As Integer)
  frm主窗体.Enabled = True
  frm主窗体.StatusBar1.Panels(1) = "杨扬工作室 作者:小杨"
End Sub

Private Sub ComEnd_Click()
  frm主窗体.Enabled = True
  Unload Me
End Sub


⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -