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

📄 frmmodifyproduct.frm

📁 this is my first software.
💻 FRM
📖 第 1 页 / 共 3 页
字号:
      EndProperty
      ColumnCount     =   2
      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
      SplitCount      =   1
      BeginProperty Split0 
         BeginProperty Column00 
         EndProperty
         BeginProperty Column01 
         EndProperty
      EndProperty
   End
   Begin MSAdodcLib.Adodc AdodcArg 
      Height          =   330
      Left            =   120
      Top             =   6480
      Width           =   1935
      _ExtentX        =   3413
      _ExtentY        =   582
      ConnectMode     =   0
      CursorLocation  =   3
      IsolationLevel  =   -1
      ConnectionTimeout=   15
      CommandTimeout  =   30
      CursorType      =   3
      LockType        =   3
      CommandType     =   8
      CursorOptions   =   0
      CacheSize       =   50
      MaxRecords      =   0
      BOFAction       =   0
      EOFAction       =   0
      ConnectStringType=   1
      Appearance      =   1
      BackColor       =   -2147483643
      ForeColor       =   -2147483640
      Orientation     =   0
      Enabled         =   -1
      Connect         =   ""
      OLEDBString     =   ""
      OLEDBFile       =   ""
      DataSourceName  =   ""
      OtherAttributes =   ""
      UserName        =   ""
      Password        =   ""
      RecordSource    =   ""
      Caption         =   ""
      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
   Begin VB.Label lblWaiJing 
      Caption         =   "外径"
      Enabled         =   0   'False
      ForeColor       =   &H00800000&
      Height          =   255
      Left            =   4200
      TabIndex        =   52
      Top             =   4200
      Width           =   615
   End
   Begin VB.Label lblNeiJing 
      Caption         =   "内径"
      Enabled         =   0   'False
      ForeColor       =   &H00800000&
      Height          =   255
      Left            =   4200
      TabIndex        =   50
      Top             =   3720
      Width           =   615
   End
   Begin VB.Label lblPinZhong 
      Caption         =   "品种"
      Enabled         =   0   'False
      ForeColor       =   &H00800000&
      Height          =   255
      Left            =   4200
      TabIndex        =   48
      Top             =   3273
      Width           =   615
   End
   Begin VB.Label lblChangJia 
      Caption         =   "厂家"
      Enabled         =   0   'False
      ForeColor       =   &H00800000&
      Height          =   255
      Left            =   2280
      TabIndex        =   46
      Top             =   5673
      Width           =   495
   End
   Begin VB.Label lblMeteralName 
      Caption         =   "原料名称"
      Enabled         =   0   'False
      ForeColor       =   &H00800000&
      Height          =   255
      Left            =   4200
      TabIndex        =   35
      Top             =   5160
      Width           =   855
   End
   Begin VB.Label lblText 
      Caption         =   "所印文字"
      Enabled         =   0   'False
      ForeColor       =   &H00800000&
      Height          =   255
      Left            =   4200
      TabIndex        =   32
      Top             =   4710
      Width           =   735
   End
   Begin VB.Label lblLangth 
      Caption         =   "长度"
      Enabled         =   0   'False
      ForeColor       =   &H00800000&
      Height          =   165
      Left            =   2280
      TabIndex        =   31
      Top             =   3315
      Width           =   735
   End
   Begin VB.Label lblColor 
      Caption         =   "颜色"
      Enabled         =   0   'False
      ForeColor       =   &H00800000&
      Height          =   255
      Left            =   2280
      TabIndex        =   18
      Top             =   5190
      Width           =   375
   End
   Begin VB.Label lblMoHou 
      Caption         =   "膜厚"
      Enabled         =   0   'False
      ForeColor       =   &H00800000&
      Height          =   255
      Left            =   2280
      TabIndex        =   17
      Top             =   4710
      Width           =   735
   End
   Begin VB.Label lblHouDu 
      Caption         =   "厚度"
      Enabled         =   0   'False
      ForeColor       =   &H00800000&
      Height          =   255
      Left            =   2280
      TabIndex        =   16
      Top             =   4230
      Width           =   375
   End
   Begin VB.Label lblWidth 
      Caption         =   "宽度"
      Enabled         =   0   'False
      ForeColor       =   &H00800000&
      Height          =   255
      Left            =   2280
      TabIndex        =   15
      Top             =   3750
      Width           =   375
   End
End
Attribute VB_Name = "frmModifyProduct"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private editmode As Boolean
Private GuiGeValue As String

Private Function IsFuHeYaoQiu() As Boolean
    IsFuHeYaoQiu = True
    If txtLangth.Enabled = True And (Trim(txtLangth.Text) = "") Then
        IsFuHeYaoQiu = False
    ElseIf txtWidth.Enabled = True And (Not IsNumeric(txtWidth.Text)) Then
        IsFuHeYaoQiu = False
    ElseIf txtHouDu.Enabled = True And (Not IsNumeric(txtHouDu.Text)) Then
        IsFuHeYaoQiu = False
    ElseIf txtMoHou.Enabled = True And (Trim(txtMoHou.Text) = "") Then
        IsFuHeYaoQiu = False
    ElseIf txtColor.Enabled = True And (Trim(txtColor.Text) = "") Then
        IsFuHeYaoQiu = False
    ElseIf txtChangJia.Enabled = True And (Trim(txtChangJia.Text) = "") Then
        IsFuHeYaoQiu = False
    ElseIf txtPinZhong.Enabled = True And (Trim(txtPinZhong.Text) = "") Then
        IsFuHeYaoQiu = False
    ElseIf txtNeiJing.Enabled = True And (Not IsNumeric(txtNeiJing.Text)) Then
        IsFuHeYaoQiu = False
    ElseIf txtWaiJing.Enabled = True And (Not IsNumeric(txtWaiJing.Text)) Then
        IsFuHeYaoQiu = False
    ElseIf txtText.Enabled = True And (Trim(txtText.Text) = "") Then
        IsFuHeYaoQiu = False
    ElseIf txtMeteralName.Enabled = True And (Trim(txtMeteralName.Text) = "") Then
        IsFuHeYaoQiu = False
    End If
    '判断是否重复,在添加和修改两种状态下都要求判断
    '判断的方法一致。
    '添加状态和修改状态一致有一点不足:如果修改时根本没有对规格的值做任何修改,那么会提示输入的内容不符合要求。
    '这时只能取消。
    cn.Open
    Set rs.ActiveConnection = cn
    rs.LockType = adLockOptimistic
    rs.CursorType = adOpenKeyset
    rs.Open "select * from 规格表 where 名称 = '" & ProductName & "' and 规格名称 = '" & GuiGeName & "' and 规格值 = '" & ValueOfGuiGe & "'"
    If rs.EOF = False Then
        IsFuHeYaoQiu = False
    End If
    rs.Close
    cn.Close

End Function
Private Function ValueOfGuiGe() As String
    If txtLangth.Enabled = True Then
        ValueOfGuiGe = txtLangth.Text
    ElseIf txtWidth.Enabled = True Then
        ValueOfGuiGe = txtWidth.Text
    ElseIf txtHouDu.Enabled = True Then
        ValueOfGuiGe = txtHouDu.Text
    ElseIf txtMoHou.Enabled = True Then
        ValueOfGuiGe = txtMoHou.Text
    ElseIf txtColor.Enabled = True Then
        ValueOfGuiGe = txtColor.Text
    ElseIf txtChangJia.Enabled = True Then
        ValueOfGuiGe = txtChangJia.Text
    ElseIf txtPinZhong.Enabled = True Then
        ValueOfGuiGe = txtPinZhong.Text
    ElseIf txtNeiJing.Enabled = True Then
        ValueOfGuiGe = txtNeiJing.Text
    ElseIf txtWaiJing.Enabled = True Then
        ValueOfGuiGe = txtWaiJing.Text
    ElseIf txtText.Enabled = True Then
        ValueOfGuiGe = txtText.Text
    ElseIf txtMeteralName.Enabled = True Then
        ValueOfGuiGe = txtMeteralName.Text
    End If
                        
End Function
Private Sub cmdAdd_Click()
    '首先应判断是否选择了长度、宽度、厚度、膜厚、颜色、厂家、品种、内径、外径、所印文字、其它产品、其它原料其中的一个
    If optLangth.Value = False And optWidth.Value = False And optHouDu.Value = False And _
        optMoHou.Value = False And optColor.Value = False And optChangJia.Value = False And _
        optPinZhong.Value = False And optNeiJing.Value = False And optWaiJing.Value = False And _
        optText.Value = False And optOtherProduct.Value = False And optOtherMeteral.Value = False Then
        MsgBox "请选择要修改的参数!", , "提示信息"
        Exit Sub
    End If
    
    If IsFuHeYaoQiu = False Then
        MsgBox "输入的内容不符合要求,请重新输入" & GuiGeName & "的值!", , "提示信息"
        Exit Sub
    End If
    cn.Open
    Set rs.ActiveConnection = cn
    rs.LockType = adLockOptimistic
    rs.CursorType = adOpenKeyset
    If editmode Then
        rs.Open "select * from 规格表 where 名称 = '" & ProductName & "' and 规格名称 = '" & GuiGeName & "' and 规格值 = '" & GuiGeValue & "'"
    Else
        rs.Open "select * from 规格表"
        rs.AddNew
    End If
    rs!名称 = ProductName
    rs!规格名称 = GuiGeName
    rs!规格值 = ValueOfGuiGe
    rs.Update
    rs.Close
    cn.Close
    
    DataGridArg.AllowUpdate = True
    SetDataGrid
    If editmode = True Then
        cmdAdd.Caption = "增加"
        cmdEdit.Enabled = True
        cmdDel.Caption = "删除"
        editmode = False            '将修改状态改为增加状态
    End If
    

    txtLangth.Text = ""
    txtWidth.Text = ""
    txtHouDu.Text = ""
    txtMoHou.Text = ""
    txtColor.Text = ""
    txtChangJia.Text = ""
    txtPinZhong.Text = ""
    txtNeiJing.Text = ""
    txtWaiJing.Text = ""
    txtText.Text = ""
    txtMeteralName.Text = ""
End Sub

Private Sub cmdCancle_Click()
    Unload Me
End Sub

Private Sub cmdDel_Click()
    '首先应判断是否选择了长度、宽度、厚度、膜厚、颜色、厂家、品种、内径、外径、所印文字、其它产品、其它原料其中的一个
    If optLangth.Value = False And optWidth.Value = False And optHouDu.Value = False And _
        optMoHou.Value = False And optColor.Value = False And optChangJia.Value = False And _
        optPinZhong.Value = False And optNeiJing.Value = False And optWaiJing.Value = False And _
        optText.Value = False And optOtherProduct.Value = False And optOtherMeteral.Value = False Then
        MsgBox "请选择要修改的参数!", , "提示信息"
        Exit Sub
    End If
    If cmdDel.Caption = "删除" Then
        If AdodcArg.Recordset.EOF Or AdodcArg.Recordset.BOF Then
            MsgBox "当前记录为空,不允许删除!", , "提示信息"
            Exit Sub
        End If
            
        DataGridArg.AllowDelete = True
        If MsgBox("确实要删除当前记录吗?", vbYesNo, "提示信息") = vbYes Then
            AdodcArg.Recordset.Delete
            If AdodcArg.Recordset.EOF = False Then
                 AdodcArg.Recordset.MoveNext
            End If
            DataGridArg.AllowDelete = False
        End If
    Else            '当取消来用
        cmdAdd.Caption = "增加"
        cmdDel.Caption = "删除"
        DataGridArg.AllowDelete = False
        cmdAdd.Enabled = True
        cmdEdit.Enabled = True
        
        txtLangth.Text = ""
        txtWidth.Text = ""
        txtHouDu.Text = ""
        txtMoHou.Text = ""
        txtColor.Text = ""
        txtText.Text = ""
        txtMeteralName.Text = ""
    End If
    DataGridArg.AllowUpdate = False
End Sub

Private Sub cmdEdit_Click()
    If AdodcArg.Recordset.EOF Or AdodcArg.Recordset.BOF Then
        MsgBox "当前记录为空,不能修改!", , "提示"
        Exit Sub
    Else
        If txtLangth.Enabled = True Then
            txtLangth.Text = AdodcArg.Recordset!规格值
        ElseIf txtWidth.Enabled = True Then
            txtWidth.Text = AdodcArg.Recordset!规格值
        ElseIf txtHouDu.Enabled = True Then
            txtHouDu.Text = AdodcArg.Recordset!规格值
        ElseIf txtMoHou.Enabled = True Then
            txtMoHou.Text = AdodcArg.Recordset!规格值
        ElseIf txtColor.Enabled = True Then
            txtColor.Text = AdodcArg.Recordset!规格值
        ElseIf txtChangJia.Enabled = True Then
            txtChangJia.Text = AdodcArg.Recordset!规格值
        ElseIf optPinZhong.Enabled = True Then
            txtPinZhong.Text = AdodcArg.Recordset!规格值
        ElseIf optNeiJing.Enabled = True Then
            txtNeiJing.Text = AdodcArg.Recordset!规格值
        ElseIf optWaiJing.Enabled = True Then
            txtWaiJing.Text = AdodcArg.Recordset!规格值
        ElseIf optText.Enabled = True Then

⌨️ 快捷键说明

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