guest.frm

来自「一套VB完整的灯具销售管理系统设计」· FRM 代码 · 共 937 行 · 第 1/2 页

FRM
937
字号
VERSION 5.00
Begin VB.Form guest 
   AutoRedraw      =   -1  'True
   BorderStyle     =   3  'Fixed Dialog
   Caption         =   "客户管理"
   ClientHeight    =   4575
   ClientLeft      =   45
   ClientTop       =   330
   ClientWidth     =   6720
   FillColor       =   &H00C0C0C0&
   Icon            =   "guest.frx":0000
   LinkTopic       =   "Form1"
   LockControls    =   -1  'True
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   4575
   ScaleWidth      =   6720
   ShowInTaskbar   =   0   'False
   StartUpPosition =   2  'CenterScreen
   Begin VB.CommandButton Edit 
      Caption         =   "修改"
      Height          =   420
      Left            =   3420
      TabIndex        =   33
      Top             =   3960
      Width           =   765
   End
   Begin VB.CommandButton Nextfind 
      Caption         =   "查找下一个"
      Enabled         =   0   'False
      Height          =   420
      Left            =   1005
      TabIndex        =   32
      Top             =   3960
      Width           =   1185
   End
   Begin VB.CommandButton Search 
      Caption         =   "查询"
      Height          =   420
      Left            =   165
      TabIndex        =   31
      Top             =   3960
      Width           =   840
   End
   Begin VB.CommandButton View 
      Caption         =   "全屏浏览"
      Height          =   420
      Left            =   2265
      TabIndex        =   30
      Top             =   3960
      Width           =   1080
   End
   Begin VB.CommandButton closeform 
      Cancel          =   -1  'True
      Caption         =   "退出"
      Height          =   420
      Left            =   5715
      TabIndex        =   23
      Top             =   3960
      Width           =   765
   End
   Begin VB.CommandButton Delete 
      Caption         =   "删除"
      Height          =   420
      Left            =   4950
      TabIndex        =   22
      Top             =   3960
      Width           =   765
   End
   Begin VB.CommandButton Add 
      Caption         =   "添加"
      Height          =   420
      Left            =   4185
      TabIndex        =   21
      Top             =   3960
      Width           =   765
   End
   Begin VB.Data Data1 
      Caption         =   "Data1"
      Connect         =   "Access"
      DatabaseName    =   ""
      DefaultCursorType=   0  'DefaultCursor
      DefaultType     =   2  'UseODBC
      Exclusive       =   0   'False
      Height          =   345
      Left            =   3885
      Options         =   0
      ReadOnly        =   0   'False
      RecordsetType   =   1  'Dynaset
      RecordSource    =   ""
      Top             =   1470
      Visible         =   0   'False
      Width           =   1800
   End
   Begin VB.CommandButton Last 
      Caption         =   "最后一个"
      Height          =   420
      Left            =   5205
      TabIndex        =   19
      Top             =   3150
      Width           =   1035
   End
   Begin VB.CommandButton Nextbutton 
      Caption         =   "下一个"
      Height          =   420
      Left            =   5205
      TabIndex        =   18
      Top             =   2730
      Width           =   1035
   End
   Begin VB.CommandButton Previous 
      Caption         =   "上一个"
      Height          =   420
      Left            =   5205
      TabIndex        =   17
      Top             =   2310
      Width           =   1035
   End
   Begin VB.CommandButton First 
      Caption         =   "第一个"
      Height          =   420
      Left            =   5205
      TabIndex        =   16
      Top             =   1890
      Width           =   1035
   End
   Begin VB.Frame Frame2 
      Caption         =   "通讯"
      ForeColor       =   &H00C00000&
      Height          =   1620
      Left            =   3090
      TabIndex        =   9
      Top             =   150
      Width           =   3270
      Begin VB.TextBox Text7 
         DataField       =   "传呼"
         DataSource      =   "Data1"
         Enabled         =   0   'False
         Height          =   285
         Left            =   885
         MaxLength       =   18
         TabIndex        =   15
         Top             =   1095
         Width           =   2220
      End
      Begin VB.TextBox Text6 
         DataField       =   "手机"
         DataSource      =   "Data1"
         Enabled         =   0   'False
         Height          =   285
         Left            =   870
         MaxLength       =   18
         TabIndex        =   14
         Top             =   742
         Width           =   2220
      End
      Begin VB.TextBox Text5 
         DataField       =   "传真"
         DataSource      =   "Data1"
         Enabled         =   0   'False
         Height          =   285
         Left            =   885
         MaxLength       =   18
         TabIndex        =   13
         Top             =   390
         Width           =   2220
      End
      Begin VB.Label Label7 
         AutoSize        =   -1  'True
         Caption         =   "传呼:"
         Height          =   180
         Left            =   315
         TabIndex        =   12
         Top             =   1125
         Width           =   540
      End
      Begin VB.Label Label6 
         AutoSize        =   -1  'True
         Caption         =   "手机:"
         Height          =   180
         Left            =   315
         TabIndex        =   11
         Top             =   765
         Width           =   540
      End
      Begin VB.Label Label5 
         AutoSize        =   -1  'True
         Caption         =   "传真:"
         Height          =   180
         Index           =   0
         Left            =   315
         TabIndex        =   10
         Top             =   390
         Width           =   540
      End
   End
   Begin VB.Frame Frame1 
      Caption         =   "联系方法"
      ForeColor       =   &H000000C0&
      Height          =   1590
      Left            =   360
      TabIndex        =   2
      Top             =   1785
      Width           =   4320
      Begin VB.TextBox Text4 
         DataField       =   "联系电话"
         DataSource      =   "Data1"
         Enabled         =   0   'False
         Height          =   270
         Left            =   1290
         MaxLength       =   26
         TabIndex        =   8
         Top             =   1155
         Width           =   2715
      End
      Begin VB.TextBox Text3 
         DataField       =   "单位地址"
         DataSource      =   "Data1"
         Enabled         =   0   'False
         Height          =   270
         Left            =   1290
         MaxLength       =   50
         TabIndex        =   7
         Top             =   765
         Width           =   2715
      End
      Begin VB.TextBox Text2 
         DataField       =   "单位名称"
         DataSource      =   "Data1"
         Enabled         =   0   'False
         Height          =   270
         Left            =   1290
         MaxLength       =   50
         TabIndex        =   3
         Top             =   375
         Width           =   2715
      End
      Begin VB.Label Label4 
         AutoSize        =   -1  'True
         Caption         =   "联系电话:"
         Height          =   180
         Index           =   0
         Left            =   360
         TabIndex        =   6
         Top             =   1200
         Width           =   900
      End
      Begin VB.Label Label3 
         AutoSize        =   -1  'True
         Caption         =   "单位地址:"
         Height          =   180
         Left            =   360
         TabIndex        =   5
         Top             =   810
         Width           =   900
      End
      Begin VB.Label Label2 
         AutoSize        =   -1  'True
         Caption         =   "单位名称:"
         Height          =   180
         Index           =   0
         Left            =   360
         TabIndex        =   4
         Top             =   435
         Width           =   900
      End
   End
   Begin VB.TextBox Text1 
      DataField       =   "姓名"
      DataSource      =   "Data1"
      Enabled         =   0   'False
      Height          =   270
      Left            =   1605
      MaxLength       =   8
      TabIndex        =   0
      Top             =   1170
      Width           =   1095
   End
   Begin VB.PictureBox Picture1 
      BackColor       =   &H00400000&
      Height          =   690
      Left            =   375
      ScaleHeight     =   630
      ScaleWidth      =   2490
      TabIndex        =   20
      Top             =   255
      Width           =   2550
      Begin VB.Label Label2 
         AutoSize        =   -1  'True
         BackStyle       =   0  'Transparent
         Caption         =   "客户"
         ForeColor       =   &H0080FFFF&
         Height          =   180
         Index           =   1
         Left            =   1620
         TabIndex        =   29
         Top             =   60
         Width           =   360
      End
      Begin VB.Label Label4 
         AutoSize        =   -1  'True
         BackStyle       =   0  'Transparent
         Caption         =   "第"
         ForeColor       =   &H00FFFFFF&
         Height          =   180
         Index           =   2
         Left            =   510
         TabIndex        =   28
         Top             =   390
         Width           =   180
      End
      Begin VB.Label zs 
         Alignment       =   2  'Center
         BackStyle       =   0  'Transparent
         ForeColor       =   &H00FFFF00&
         Height          =   225
         Left            =   825
         TabIndex        =   27
         Top             =   75
         Width           =   690
      End
      Begin VB.Label dq 
         Alignment       =   2  'Center
         BackStyle       =   0  'Transparent
         ForeColor       =   &H0000FFFF&
         Height          =   225
         Left            =   825
         TabIndex        =   26
         Top             =   360
         Width           =   690
      End
      Begin VB.Label Label5 
         AutoSize        =   -1  'True
         BackStyle       =   0  'Transparent
         Caption         =   "客户"
         ForeColor       =   &H00FFFFFF&
         Height          =   180
         Index           =   1
         Left            =   1635
         TabIndex        =   25
         Top             =   375
         Width           =   360
      End
      Begin VB.Label Label4 
         AutoSize        =   -1  'True
         BackStyle       =   0  'Transparent
         Caption         =   "共"
         ForeColor       =   &H00FFFFFF&
         Height          =   180
         Index           =   1
         Left            =   480
         TabIndex        =   24
         Top             =   60
         Width           =   180
      End
   End
   Begin VB.Line Line2 
      BorderColor     =   &H00FFFFFF&
      X1              =   90
      X2              =   6675
      Y1              =   3735
      Y2              =   3735
   End
   Begin VB.Line Line1 
      X1              =   120
      X2              =   6645
      Y1              =   3720
      Y2              =   3720
   End
   Begin VB.Label Label1 
      AutoSize        =   -1  'True
      Caption         =   "客户姓名:"
      Height          =   180
      Left            =   630
      TabIndex        =   1
      Top             =   1215
      Width           =   900
   End
End
Attribute VB_Name = "guest"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub add_Click()
'保存新记录
  If Add.Caption = "保存" Then
     
     Add.Enabled = True
     '移动按钮,全解
     First.Enabled = True
     Previous.Enabled = True
     Nextbutton.Enabled = True
     Last.Enabled = True
     Search.Enabled = True
     View.Enabled = True
     Edit.Enabled = True
     
     Add.Caption = "添加"
     Delete.Caption = "删除"
     CloseForm.Enabled = True
     Data1.Recordset.MoveLast
     Text1.Enabled = False
     Text2.Enabled = False
     Text3.Enabled = False
     Text4.Enabled = False
     Text5.Enabled = False
     Text6.Enabled = False
     Text7.Enabled = False
     '判断库是否为空
    Dim db As Database, ef As Recordset, CountNum As Integer, xy As Integer
       Set db = OpenDatabase(appData)
       Set ef = db.OpenRecordset("guestk", dbOpenTable)
       CountNum = ef.RecordCount
       zs.Caption = CountNum
     If CountNum = 0 Then
     Add.Enabled = True
     Delete.Enabled = False
     First.Enabled = False
     Previous.Enabled = False
     Nextbutton.Enabled = False
     Last.Enabled = False
     Else
      Add.Enabled = True
      Delete.Enabled = True
      First.Enabled = True
      Previous.Enabled = True
      Nextbutton.Enabled = True
      Last.Enabled = True
      End If
      db.Close
         Exit Sub
   End If
   '添加新记录代码

   Add.Enabled = False
   Delete.Enabled = True
   '移动按钮,全锁
   First.Enabled = False
   Previous.Enabled = False
   Nextbutton.Enabled = False
   Last.Enabled = False
     Search.Enabled = False
     Nextfind.Enabled = False
     View.Enabled = False
     Edit.Enabled = False
     
   Add.Caption = "保存"
   Delete.Caption = "放弃"
   CloseForm.Enabled = False
   Text1.Enabled = True
   Text2.Enabled = True
   Text3.Enabled = True
   Text4.Enabled = True
   Text5.Enabled = True
   Text6.Enabled = True
   Text7.Enabled = True
   Text1.SetFocus
   Data1.Recordset.AddNew
End Sub

Private Sub CloseForm_Click()
'取消修改
If CloseForm.Caption = "取消" Then
   Edit.Caption = "修改"
   Edit.Enabled = True
   CloseForm.Caption = "退出"
   Data1.Recordset.CancelUpdate
   Text2.Enabled = False

⌨️ 快捷键说明

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