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

📄 form2.frm

📁 一套简单的销售管理系统
💻 FRM
字号:
VERSION 5.00
Object = "{CFA7AFF4-3242-4269-9172-7389D695AE01}#1.0#0"; "StoneXP.ocx"
Begin VB.Form Form2 
   BackColor       =   &H00FFFFFF&
   BorderStyle     =   1  'Fixed Single
   Caption         =   "新商品添加"
   ClientHeight    =   2370
   ClientLeft      =   45
   ClientTop       =   435
   ClientWidth     =   4530
   Icon            =   "Form2.frx":0000
   LinkTopic       =   "Form2"
   MaxButton       =   0   'False
   ScaleHeight     =   2370
   ScaleWidth      =   4530
   StartUpPosition =   2  '屏幕中心
   Begin 销售系统.FCombo text1 
      Height          =   315
      Index           =   0
      Left            =   1200
      TabIndex        =   5
      Top             =   570
      Width           =   2295
      _ExtentX        =   4048
      _ExtentY        =   556
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "宋体"
         Size            =   9
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Text            =   ""
      ListIndex       =   -1
   End
   Begin VB.Timer Timer1 
      Interval        =   10
      Left            =   4080
      Top             =   1320
   End
   Begin StoneXP.XPButton XPButton2 
      Height          =   375
      Left            =   2520
      TabIndex        =   4
      Top             =   1800
      Width           =   1215
      _ExtentX        =   2143
      _ExtentY        =   661
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "宋体"
         Size            =   9
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Caption         =   "离 开"
      MouseIcon       =   "Form2.frx":F84A
      MousePointer    =   99
   End
   Begin StoneXP.XPButton XPButton1 
      Height          =   375
      Left            =   600
      TabIndex        =   3
      Top             =   1800
      Width           =   1215
      _ExtentX        =   2143
      _ExtentY        =   661
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "宋体"
         Size            =   9
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Caption         =   "确 定"
      MouseIcon       =   "Form2.frx":FB64
      MousePointer    =   99
   End
   Begin 销售系统.FCombo text1 
      Height          =   315
      Index           =   1
      Left            =   1320
      TabIndex        =   6
      Top             =   960
      Width           =   2295
      _ExtentX        =   4048
      _ExtentY        =   556
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "宋体"
         Size            =   9
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Text            =   ""
      ListIndex       =   -1
   End
   Begin 销售系统.FCombo text1 
      Height          =   315
      Index           =   2
      Left            =   1320
      TabIndex        =   7
      Top             =   1320
      Width           =   2295
      _ExtentX        =   4048
      _ExtentY        =   556
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "宋体"
         Size            =   9
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Text            =   ""
      ListIndex       =   -1
   End
   Begin VB.Label Label1 
      BackStyle       =   0  'Transparent
      Caption         =   "新单位电话:"
      ForeColor       =   &H00000000&
      Height          =   255
      Index           =   2
      Left            =   120
      TabIndex        =   2
      Top             =   1350
      Width           =   1335
   End
   Begin VB.Label Label1 
      BackStyle       =   0  'Transparent
      Caption         =   "新单位地址:"
      ForeColor       =   &H00000000&
      Height          =   255
      Index           =   1
      Left            =   120
      TabIndex        =   1
      Top             =   990
      Width           =   1095
   End
   Begin VB.Label Label1 
      BackStyle       =   0  'Transparent
      Caption         =   "新单位名称:"
      ForeColor       =   &H00000000&
      Height          =   255
      Index           =   0
      Left            =   120
      TabIndex        =   0
      Top             =   600
      Width           =   1095
   End
End
Attribute VB_Name = "Form2"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim i As Integer
Private Sub Form_Load()
'Form2.BackColor = RGB(97, 69, 133)
'For i = 0 To 2
'text1(i).BackColor = Form2.BackColor
'Next
XPButton1.Default = True
End Sub

Private Sub Text1_Change(Index As Integer)
If Index = 0 Then
If Text1(0).Text <> "" Then
Set s2 = cnn.Execute("select * from 商品名称 where 商品类型='" & Text1(0).Text & "'")
Text1(1).Clear
Do While s2.EOF = False
Text1(1).AddItem s2.Fields(1)
s2.MoveNext
Loop
Set s2 = Nothing
End If
End If
End Sub

Private Sub Timer1_Timer()
If duixiang = 1 Then
Label1(0).Caption = "新单位名称:"
Label1(1).Caption = "新单位地址:"
Label1(2).Caption = "新单位电话:"
Me.Caption = "新对象单位添加"
End If
If duixiang = 2 Then
Label1(0).Caption = "新商品类型:"
Label1(1).Caption = "新商品名称:"
Label1(2).Caption = "对应商品型号:"
Set s1 = cnn.Execute("select * from 商品类型")
Text1(0).Clear
Do While s1.EOF = False
Text1(0).AddItem s1.Fields(0)
s1.MoveNext
Loop
Me.Caption = "新商品添加"
End If
Timer1.Interval = 0
End Sub

Private Sub XPButton1_Click()
If Text1(0).Text = "" And Text1(1).Text = "" Then
MsgBox "数据没有输入完整!", vbInformation, "输入错误"
Exit Sub
End If
If duixiang = 1 Then
        If qy2.State = adStateOpen Then '检测单位是否在列表中
         qy2.Close
        End If
           qy2.Open "select * from 合作单位 where 单位名称='" & Text1(0).Text & "'", cnn, adOpenKeyset, adLockOptimistic, adCmdText
           If qy2.EOF = True Then
             qy2.AddNew
             For i = 0 To 2
             qy2.Fields(i) = Text1(i).Text
             Next
             qy2.Update
             MsgBox "添加成功,继续操作", vbInformation, "添加成功"
            Else
            MsgBox "该单位己经存在,无须再次添加!", vbInformation, "单位名称己存在"
            End If
 End If
If duixiang = 2 Then
jsql = "select * from 商品类型 where 商品类型='" & Text1(0).Text & "'"
Set s1 = cnn.Execute(jsql)
If s1.EOF = True Then
jsql = "insert into 商品类型 values('" & Text1(0).Text & "')"
Set s1 = cnn.Execute(jsql)
End If
jsql = "select * from 商品名称 where 商品类型='" & Text1(1).Text & "'"
Set s1 = cnn.Execute(jsql)
If s1.EOF = True Then
jsql = "insert into 商品名称 values('" & Text1(0).Text & "','" & Text1(1).Text & "')"
Set s1 = cnn.Execute(jsql)
End If
If Text1(2).Text <> "" Then
jsql = "select * from 商品型号 where 商品型号='" & Text1(2).Text & "' and 商品名称='" & Text1(1).Text & "'"
Set s1 = cnn.Execute(jsql)
If s1.EOF = True Then
jsql = "insert into 商品型号 values('" & Text1(0).Text & "','" & Text1(1).Text & "','" & Text1(2).Text & "')"
Set s1 = cnn.Execute(jsql)
Text1(2).Text = ""
Else
MsgBox "当前商品己存在!", vbInformation, "商品重复"
Exit Sub
End If
End If
Set s1 = Nothing
MsgBox "新商品添加成功!", vbInformation, "操作成功"
End If
End Sub

Private Sub XPButton2_Click()
Unload Me
End Sub

⌨️ 快捷键说明

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