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

📄 frmbuygoods.frm

📁 一个关于进销存的源代码
💻 FRM
字号:
VERSION 5.00
Object = "{86CF1D34-0C5F-11D2-A9FC-0000F8754DA1}#2.0#0"; "mscomct2.ocx"
Begin VB.Form frmBuyGoods 
   Caption         =   "进货登记"
   ClientHeight    =   4350
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   3540
   LinkTopic       =   "Form1"
   ScaleHeight     =   4350
   ScaleWidth      =   3540
   StartUpPosition =   2  '屏幕中心
   Begin VB.Frame Frame3 
      Caption         =   "--命令提示符--"
      Height          =   735
      Left            =   120
      TabIndex        =   11
      Top             =   3480
      Width           =   3255
      Begin VB.CommandButton Command2 
         Caption         =   "取消"
         Height          =   375
         Left            =   2160
         TabIndex        =   9
         Top             =   240
         Width           =   735
      End
      Begin VB.CommandButton Command1 
         Caption         =   "确定"
         Height          =   375
         Left            =   240
         TabIndex        =   8
         Top             =   240
         Width           =   735
      End
   End
   Begin VB.Frame Frame2 
      Caption         =   "--进货登记--"
      Height          =   1455
      Left            =   120
      TabIndex        =   10
      Top             =   1920
      Width           =   3255
      Begin VB.TextBox Text4 
         Enabled         =   0   'False
         Height          =   270
         Left            =   1320
         TabIndex        =   7
         Top             =   1080
         Width           =   1695
      End
      Begin VB.TextBox Text3 
         Height          =   270
         Left            =   1320
         TabIndex        =   6
         Top             =   720
         Width           =   1695
      End
      Begin MSComCtl2.DTPicker DTPicker1 
         Height          =   255
         Left            =   1320
         TabIndex        =   5
         Top             =   240
         Width           =   1695
         _ExtentX        =   2990
         _ExtentY        =   450
         _Version        =   393216
         Format          =   148635649
         CurrentDate     =   38983
      End
      Begin VB.Label Label7 
         Caption         =   "最新数量"
         Height          =   255
         Left            =   240
         TabIndex        =   18
         Top             =   1080
         Width           =   855
      End
      Begin VB.Label Label6 
         Caption         =   "入库数量"
         Height          =   255
         Left            =   240
         TabIndex        =   17
         Top             =   720
         Width           =   735
      End
      Begin VB.Label Label5 
         Caption         =   "入库日期"
         Height          =   255
         Left            =   240
         TabIndex        =   16
         Top             =   240
         Width           =   735
      End
   End
   Begin VB.Frame Frame1 
      Caption         =   "--库存信息--"
      Height          =   1695
      Left            =   120
      TabIndex        =   0
      Top             =   120
      Width           =   3255
      Begin VB.TextBox Text2 
         Height          =   270
         Left            =   1320
         TabIndex        =   4
         Top             =   1320
         Width           =   1695
      End
      Begin VB.TextBox Text1 
         Height          =   270
         Left            =   1320
         TabIndex        =   3
         Top             =   960
         Width           =   1695
      End
      Begin VB.ComboBox Combo2 
         Height          =   300
         Left            =   1320
         Style           =   2  'Dropdown List
         TabIndex        =   2
         Top             =   600
         Width           =   1695
      End
      Begin VB.ComboBox Combo1 
         Height          =   300
         Left            =   1320
         Style           =   2  'Dropdown List
         TabIndex        =   1
         Top             =   240
         Width           =   1695
      End
      Begin VB.Label Label4 
         Caption         =   "存货数量"
         Height          =   255
         Left            =   240
         TabIndex        =   15
         Top             =   1320
         Width           =   855
      End
      Begin VB.Label Label3 
         Caption         =   "商品代码"
         Height          =   255
         Left            =   240
         TabIndex        =   14
         Top             =   960
         Width           =   735
      End
      Begin VB.Label Label2 
         Caption         =   "商品名称"
         Height          =   255
         Left            =   240
         TabIndex        =   13
         Top             =   600
         Width           =   735
      End
      Begin VB.Label label1 
         Caption         =   "商品类别"
         Height          =   255
         Left            =   240
         TabIndex        =   12
         Top             =   240
         Width           =   855
      End
   End
End
Attribute VB_Name = "frmBuyGoods"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private Sub ttcls()
    Text1.Text = ""
    Text2.Text = ""
    Text3.Text = ""
    Text4.Text = ""
End Sub

Private Sub Combo1_click()
    Combo2.Clear
    ttcls
    Dim rdst As New ADODB.Recordset
    rdst.Open "select * from productslist where 商品类别 = '" & Combo1.Text & "'order by 商品名称 desc", g_conn
        Do While Not rdst.EOF
                If Combo2.List(0) <> rdst!商品名称 Then
                     Combo2.AddItem rdst!商品名称, 0
                End If
            rdst.MoveNext
        Loop
    Combo2.AddItem "", 0
End Sub

Private Sub Combo2_Click()
    Dim rdst As New ADODB.Recordset
    rdst.Open "select * from productslist where 商品名称='" & Combo2.Text & "'", g_conn
         Text1.Text = rdst!商品代码
         Text2.Text = rdst!库存量
         
End Sub
Private Sub Command1_Click()
    
    
    If Combo2.Text <> "" And Text3.Text <> "" Then
            '单日入库登记表更新
            Dim rdst As New ADODB.Recordset
            '添加入库记录--------类别,名称,代码,日期,数量
                 rdst.Open "insert into buygoods values('" & Combo1.Text & "','" & Combo2.Text & "','" & Text1.Text & "','" & DTPicker1.Value & "','" & Text3.Text & "')", g_conn
            Set rdst = Nothing
            '更改库存量
                 rdst.Open "update productsList set 库存量 = '" & Text4.Text & "' where 商品名称 = '" & Combo2.Text & "'", g_conn
             Set rdst = Nothing
             MsgBox "数据入库成功", vbOKCancel
             Combo2_Click
             
     
     Else
             MsgBox "请指定商品名称和入库数量", vbOKCancel
     End If
     
     
     Text3.Text = ""
     Text4.Text = ""
End Sub

Private Sub Command2_Click()
    Unload Me
End Sub
Private Sub Form_Load()
    Text1.Enabled = False
    Text2.Enabled = False
    DTPicker1.Value = Date
    Combo1.Clear
    Text2.Enabled = False
    Dim rdst As New ADODB.Recordset
        rdst.Open "select * from productsList order by 商品类别 desc", g_conn
            Do While Not rdst.EOF
                    If rdst!商品类别 <> Combo1.List(0) Then
                         Combo1.AddItem rdst!商品类别, 0
                    End If
                rdst.MoveNext
            Loop
        Combo1.AddItem "", 0
End Sub

Private Sub Text3_Change()
    Text4.Text = Val(Text3.Text) + Val(Text2.Text)
End Sub

⌨️ 快捷键说明

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