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

📄 main_jbzl_cpgl_lr.frm

📁 企业营销管理系统本着经济、实用、高效的原则
💻 FRM
字号:
VERSION 5.00
Begin VB.Form main_jbzl_cpgl_lr 
   BorderStyle     =   3  'Fixed Dialog
   Caption         =   "Form1"
   ClientHeight    =   2235
   ClientLeft      =   45
   ClientTop       =   330
   ClientWidth     =   6075
   Icon            =   "main_jbzl_cpgl_lr.frx":0000
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   2235
   ScaleWidth      =   6075
   ShowInTaskbar   =   0   'False
   StartUpPosition =   2  '屏幕中心
   Begin VB.CommandButton Command1 
      Caption         =   "确定"
      Height          =   390
      Left            =   1185
      TabIndex        =   12
      Top             =   1755
      Width           =   1770
   End
   Begin VB.CommandButton Command2 
      Caption         =   "取消"
      Height          =   390
      Left            =   3075
      TabIndex        =   11
      Top             =   1755
      Width           =   1770
   End
   Begin VB.Frame Frame1 
      Height          =   1650
      Left            =   0
      TabIndex        =   0
      Top             =   0
      Width           =   6045
      Begin VB.TextBox Text1 
         Height          =   330
         Index           =   1
         Left            =   825
         TabIndex        =   5
         Top             =   525
         Width           =   5160
      End
      Begin VB.TextBox Text1 
         Height          =   330
         Index           =   2
         Left            =   825
         TabIndex        =   4
         Top             =   885
         Width           =   2340
      End
      Begin VB.TextBox Text1 
         Height          =   330
         Index           =   3
         Left            =   3645
         TabIndex        =   3
         Top             =   885
         Width           =   2340
      End
      Begin VB.TextBox Text1 
         Height          =   330
         Index           =   0
         Left            =   825
         Locked          =   -1  'True
         TabIndex        =   2
         Top             =   165
         Width           =   2340
      End
      Begin VB.TextBox Text1 
         Height          =   330
         Index           =   4
         Left            =   825
         TabIndex        =   1
         Top             =   1245
         Width           =   5160
      End
      Begin VB.Label Label1 
         BackStyle       =   0  'Transparent
         Caption         =   "产品编号"
         ForeColor       =   &H000000FF&
         Height          =   165
         Left            =   75
         TabIndex        =   10
         Top             =   240
         Width           =   735
      End
      Begin VB.Label Label2 
         Caption         =   "品名规格"
         ForeColor       =   &H000000FF&
         Height          =   165
         Left            =   60
         TabIndex        =   9
         Top             =   585
         Width           =   795
      End
      Begin VB.Label Label4 
         Caption         =   "单位"
         Height          =   165
         Left            =   390
         TabIndex        =   8
         Top             =   975
         Width           =   405
      End
      Begin VB.Label Label8 
         Caption         =   "单价"
         Height          =   165
         Left            =   3240
         TabIndex        =   7
         Top             =   975
         Width           =   795
      End
      Begin VB.Label Label6 
         Caption         =   "备注"
         Height          =   165
         Left            =   405
         TabIndex        =   6
         Top             =   1335
         Width           =   735
      End
   End
End
Attribute VB_Name = "main_jbzl_cpgl_lr"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim rs1 As New ADODB.Recordset
Private Sub Form_Activate()
  Text1(1).SetFocus
End Sub
Private Sub Form_Load()
  If blnAddCP = True Then
     Me.Caption = "产品信息添加"
     rs1.Open "select * from 产品信息表 order by 产品编号", Cnn, adOpenKeyset
     If rs1.RecordCount > 0 Then
        rs1.MoveLast
        Text1(0) = Format(Val(rs1.Fields("产品编号")) + 1, "00000")
     Else
        Text1(0) = "00001"
     End If
     rs1.Close
     For i = 1 To Text1.UBound
       Text1(i) = ""
     Next i
  Else
     Me.Caption = "产品信息修改"
     With main_jbzl_cpgl.Adodc1.Recordset
     For i = 0 To Text1.UBound
       Text1(i) = .Fields(i)
     Next i
     End With
  End If
End Sub
Private Sub Text1_GotFocus(Index As Integer)
  Text1(Index).BackColor = &HFFFF00
  Text1(Index).SelStart = 0
  Text1(Index).SelLength = Len(Text1(Index))
End Sub
Private Sub Text1_KeyDown(Index As Integer, KeyCode As Integer, Shift As Integer)
  If KeyCode = vbKeyReturn And Index < 4 Then Text1(Index + 1).SetFocus
  If KeyCode = vbKeyReturn And Index = 4 Then Command1.SetFocus
End Sub
Private Sub Text1_LostFocus(Index As Integer)
  Text1(Index).BackColor = &H80000005
End Sub
Private Sub Command1_Click()
  If IsNumeric(Text1(3)) = False Then
    MsgBox "请在“单价”文本框中输入数值型数据!"
    Exit Sub
  End If
  If Text1(1) = "" Then
    MsgBox "品名规格不允许为空!", , "提示"
    Exit Sub
  End If
  On Error GoTo SaveErr
  If blnAddCP = True Then
     Cnn.Execute ("insert into 产品信息表 values('" + Text1(0) + "','" + Text1(1) + "','" + Text1(2) + _
     "'," + Text1(3) + ",'" + Text1(4) + "')")
    main_jbzl_cpgl.Adodc1.Refresh
  Else
    Cnn.Execute ("update 产品信息表 set 品名规格 ='" + Text1(1) + "',单位 ='" + Text1(2) + _
    "',单价 =" + Text1(3) + ",备注='" + Text1(4) + "'where 产品编号 ='" + Text1(0) + "'")
     main_jbzl_cpgl.Adodc1.Refresh
     main_jbzl_cpgl.DataGrid1.Bookmark = CPBookmark
  End If

  Unload Me
  Exit Sub
SaveErr:
  MsgBox Err.Description
End Sub
Private Sub Command2_Click()
  Unload Me
End Sub

⌨️ 快捷键说明

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