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

📄 add.frm

📁 本系统是根据企业的特点
💻 FRM
字号:
VERSION 5.00
Begin VB.Form add 
   Caption         =   "入库操作"
   ClientHeight    =   4170
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   3900
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   ScaleHeight     =   4170
   ScaleWidth      =   3900
   StartUpPosition =   2  '屏幕中心
   Begin VB.TextBox Text5 
      Height          =   375
      Left            =   1560
      TabIndex        =   11
      Top             =   2640
      Width           =   1695
   End
   Begin VB.CommandButton Command2 
      Caption         =   "取消"
      Height          =   495
      Left            =   2160
      TabIndex        =   9
      Top             =   3480
      Width           =   1215
   End
   Begin VB.CommandButton Command1 
      Caption         =   "确定"
      Height          =   495
      Left            =   120
      TabIndex        =   8
      Top             =   3480
      Width           =   1215
   End
   Begin VB.TextBox Text4 
      Height          =   375
      Left            =   1560
      MaxLength       =   8
      TabIndex        =   6
      Top             =   2040
      Width           =   1695
   End
   Begin VB.TextBox Text3 
      Height          =   375
      Left            =   1560
      MaxLength       =   10
      TabIndex        =   3
      Top             =   1440
      Width           =   1695
   End
   Begin VB.TextBox Text2 
      Height          =   375
      Left            =   1560
      MaxLength       =   50
      TabIndex        =   2
      Top             =   840
      Width           =   1695
   End
   Begin VB.TextBox Text1 
      Height          =   375
      Left            =   1560
      MaxLength       =   50
      TabIndex        =   0
      Top             =   240
      Width           =   1695
   End
   Begin VB.Label Label5 
      Caption         =   "进 货 日 期"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   10.5
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   240
      TabIndex        =   10
      Top             =   2640
      Width           =   1215
   End
   Begin VB.Label Label4 
      Caption         =   "供 应 商 :"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   10.5
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   240
      TabIndex        =   7
      Top             =   2040
      Width           =   1335
   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          =   375
      Left            =   240
      TabIndex        =   5
      Top             =   1440
      Width           =   1455
   End
   Begin VB.Label Label2 
      Caption         =   "价      格:"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   10.5
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   240
      TabIndex        =   4
      Top             =   840
      Width           =   1335
   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          =   255
      Left            =   240
      TabIndex        =   1
      Top             =   240
      Width           =   1455
   End
End
Attribute VB_Name = "add"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
Set conn = New ADODB.Connection
          conn.Open "DSN=电脑经营系统", ";pwd=14813808"
          Set ado = New ADODB.Recordset
          ado.Open "select * from 公司业务情况", conn, adOpenStatic, adLockOptimistic
          
          
          Set adoshang = New ADODB.Recordset
          adoshang.Open "select * from 供应商", conn, 3, 2
          
          
          
          
   If Len(Text1.Text) > 50 Or Text1.Text = "" Then
   MsgBox "名称不符合要求!", vbExclamation, "提醒"
       Text1.Text = ""
       Exit Sub
    Else
       Set ado = New ADODB.Recordset
          ado.Open "select * from 公司业务情况 where 型号和名称='" & Trim(Text1.Text) & "'", conn, adOpenStatic, adLockOptimistic
     If ado.RecordCount > 0 Then
     MsgBox "注意!!已经存在此产品!", vbDefaultButton2 + vbInformation, "系统提示"
         If Not IsNumeric(Text2.Text) Then
             MsgBox "价格是数值型的!", vbExclamation, "提醒"
              Text2.Text = ""
              Exit Sub
         Else
            ado("价格") = Text2.Text
            If Not IsNumeric(Text3.Text) Then
            MsgBox "库存量是数值型的!", vbExclamation, "提醒"
            Text3.Text = ""
            Exit Sub
            Else
            ado("库存量") = ado("库存量") + Val(Text3.Text)
            End If
         End If
  Else
    ado.AddNew
       If Len(Text1.Text) > 50 Or Text1.Text = "" Then
   MsgBox "名称不符合要求!", vbExclamation, "提醒"
       Text1.Text = ""
       Exit Sub
    Else
   ado("型号和名称") = Text1.Text
   End If
   If Not IsNumeric(Text2.Text) Then
       MsgBox "价格是数值型的!", vbExclamation, "提醒"
       Text2.Text = ""
              Exit Sub
    Else
   ado("价格") = Text2.Text
   End If
    If Not IsNumeric(Text3.Text) Then
       MsgBox "库存量是数值型的!", vbExclamation, "提醒"
       Text3.Text = ""
       Exit Sub
    Else
   ado("库存量") = Text3.Text
   End If
    If Len(Text4.Text) > 8 Or Text4.Text = "" Then
       MsgBox "必须填供应商的名字!", vbExclamation, "提醒"
       Text4.Text = ""
       Exit Sub
    Else
   ado("供应商") = Text4.Text
   End If
             If Not IsDate(Text5) Then
              MsgBox "请正确输入日期!", vbOKOnly + vbExclamation, "警告"
              Exit Sub
              Else
              Text8 = Format((Text8), "yyyy-mm-dd")
              adoshang.AddNew
              
              adoshang.Fields("型号和名称") = Text1.Text
              adoshang.Fields("价格") = Text2.Text
              adoshang.Fields("件数") = Text3.Text
              adoshang.Fields("供应商") = Text4.Text
              adoshang.Fields("进货日期") = Text5.Text
              adoshang.Update
              
               End If
   
   
   
End If
End If
   ado.Update
   add.Hide
   Unload add
   MsgBox "入库操作成功!", vbExclamation, "系统提示"

End Sub

Private Sub Command2_Click()
   MsgBox "入库操作失败!", vbExclamation, "系统提示"
Me.Hide

End Sub

Private Sub Form_Load()
Set conn = New ADODB.Connection
conn.Open "DSN=电脑经营系统", ";pwd=14813808"
Set ado = New ADODB.Recordset
ado.Open "select * from 公司业务情况", conn, adOpenStatic, adLockOptimistic

End Sub


⌨️ 快捷键说明

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