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

📄 frminstock.frm

📁 VB礼品店销售管理系统 包括ACCESS数据库访问职工管理 账单管理
💻 FRM
📖 第 1 页 / 共 2 页
字号:
      End
      Begin VB.TextBox txtMarketPrice 
         Height          =   495
         Left            =   4320
         TabIndex        =   5
         Top             =   1800
         Width           =   2175
      End
      Begin VB.TextBox txtnumber 
         Height          =   495
         Left            =   7320
         TabIndex        =   3
         Top             =   1080
         Width           =   1815
      End
      Begin VB.TextBox txtPriceIn 
         Height          =   495
         Left            =   1200
         TabIndex        =   4
         Top             =   1760
         Width           =   2175
      End
      Begin VB.TextBox txtName 
         Height          =   495
         Left            =   1200
         TabIndex        =   0
         Top             =   360
         Width           =   2175
      End
      Begin VB.TextBox txtId 
         Height          =   495
         Left            =   4320
         TabIndex        =   1
         Top             =   360
         Width           =   2175
      End
      Begin VB.CommandButton cmdImportPic 
         Caption         =   "导入图片"
         Height          =   495
         Left            =   9360
         TabIndex        =   8
         Top             =   1080
         Width           =   975
      End
      Begin MSComCtl2.DTPicker DTPDate 
         Height          =   375
         Left            =   1200
         TabIndex        =   10
         Top             =   1120
         Width           =   2175
         _ExtentX        =   3836
         _ExtentY        =   661
         _Version        =   393216
         Format          =   21102592
         CurrentDate     =   38885
         MinDate         =   36526
      End
      Begin MSComCtl2.DTPicker DTPTime 
         Height          =   375
         Left            =   4320
         TabIndex        =   13
         Top             =   1120
         Width           =   2175
         _ExtentX        =   3836
         _ExtentY        =   661
         _Version        =   393216
         Format          =   21102594
         CurrentDate     =   38885.3333333333
      End
      Begin VB.Label Label9 
         AutoSize        =   -1  'True
         Caption         =   "树种"
         Height          =   180
         Left            =   6720
         TabIndex        =   22
         Top             =   480
         Width           =   360
      End
      Begin VB.Label Label8 
         AutoSize        =   -1  'True
         Caption         =   "最低售价"
         Height          =   180
         Left            =   6600
         TabIndex        =   18
         Top             =   1920
         Width           =   720
      End
      Begin VB.Label Label5 
         AutoSize        =   -1  'True
         Caption         =   "数量"
         Height          =   180
         Left            =   6720
         TabIndex        =   17
         Top             =   1200
         Width           =   360
      End
      Begin VB.Label Label2 
         AutoSize        =   -1  'True
         Caption         =   "产品编号"
         Height          =   180
         Left            =   3480
         TabIndex        =   16
         Top             =   480
         Width           =   720
      End
      Begin VB.Label Label7 
         AutoSize        =   -1  'True
         Caption         =   "市场定价"
         Height          =   180
         Left            =   3480
         TabIndex        =   15
         Top             =   1920
         Width           =   720
      End
      Begin VB.Label Label4 
         AutoSize        =   -1  'True
         Caption         =   "进货价格"
         Height          =   180
         Left            =   360
         TabIndex        =   14
         Top             =   1920
         Width           =   720
      End
      Begin VB.Label Label1 
         AutoSize        =   -1  'True
         Caption         =   "产品名称"
         Height          =   180
         Left            =   360
         TabIndex        =   12
         Top             =   480
         Width           =   720
      End
      Begin VB.Label Label3 
         AutoSize        =   -1  'True
         Caption         =   "入库时间"
         Height          =   180
         Left            =   360
         TabIndex        =   11
         Top             =   1200
         Width           =   720
      End
      Begin VB.Label Label6 
         AutoSize        =   -1  'True
         Caption         =   "产品图片"
         Height          =   180
         Left            =   9480
         TabIndex        =   9
         Top             =   480
         Width           =   720
      End
      Begin VB.Image imgProduct 
         BorderStyle     =   1  'Fixed Single
         Height          =   2895
         Left            =   10560
         Stretch         =   -1  'True
         Top             =   360
         Width           =   3495
      End
   End
End
Attribute VB_Name = "frmInstock"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim imgname As String
Private Sub ClearData()
    txtName = ""
    txtId = ""
    txtLowest = ""
    txtMarketPrice = ""
    txtNumber = ""
    txtPriceIn = ""
    txtTreeSort = ""
    imgProduct.Picture = LoadPicture("")
    DTPDate.Value = Date
    DTPTime.Value = Time
End Sub
Private Function CheckData() As Boolean
    Flag = True
    If Trim(txtId) = "" Then
        MsgBox "产品编号不能为空,请输入产品编号!", 48, "信息提示"
        txtId.SetFocus
        Flag = False
    ElseIf Trim(txtName) = "" Then
        MsgBox "产品名称不能为空,请输入产品名称!", 48, "信息提示"
        txtName.SetFocus
        Flag = False
    ElseIf Trim(txtTreeSort) = "" Then
        MsgBox "树种不能为空,请输入树种!", 48, "信息提示"
        txtTreeSort.SetFocus
        Flag = False
    ElseIf IsNumeric(txtPriceIn) = False Then
        MsgBox "进货价格必须为数字!", 48, "信息提示"
        txtPriceIn.SetFocus
        Flag = False
    ElseIf IsNumeric(txtNumber) = False Then
        MsgBox "进货数量必须为数字", 48, "信息提示"
        txtNumber.SetFocus
        Flag = False
    ElseIf IsNumeric(txtMarketPrice) = False Then
        MsgBox "市场定价必须为数字!", 48, "信息提示"
        txtMarketPrice.SetFocus
        Flag = False
    ElseIf IsNumeric(txtLowest) = False Then
        MsgBox "最低售价必须为数字!", 48, "信息提示"
        txtLowest.SetFocus
        Flag = False
    End If
    CheckData = Flag
End Function
Private Sub cmdAdd_Click()
On Error GoTo errhandle
    If CheckData() = False Then Exit Sub
    dbs.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & dbFile & ";Persist Security Info=False"
    sqlstring = "insert into product values('" & Trim(txtId.Text) & "','" & Trim(txtName.Text) & _
            "','" & DTPDate.Value & " " & DTPTime.Value & "'," & txtNumber.Text & "," & txtNumber.Text & "," & txtPriceIn.Text & _
            ",'" & comDialog.FileName & "'," & txtMarketPrice.Text & "," & txtLowest.Text & ",'" & txtTreeSort & "')"

    dbs.Execute sqlstring
    dbs.Close
    Adodc1.Refresh
    DataGrid1.Refresh
    MsgBox "成功填加该产品信息,操作完成!", 48, "信息提示"
    Call ClearData
    Exit Sub
errhandle:
   If Err.Number = -2147467259 Then
        MsgBox "产品编号必须唯一,请重新输入产品编号!", 48, "信息提示"
        txtId.SetFocus
    Else
        MsgBox "有错误发生,错误编号为:" & Err.Number, 48, "信息提示"
   End If
End Sub

Private Sub cmdDel_Click()
    If Trim(txtId.Text) = "" Then
        MsgBox "请选择要删除的产品编号!", 48, "信息提示"
        Exit Sub
    End If
    sqlstring = "delete from product where productid='" & txtId.Text & "'"
    dbs.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & dbFile & ";Persist Security Info=False"

    dbs.Execute sqlstring
    dbs.Close
    Adodc1.Refresh
    MsgBox "成功删除该产品信息,操作完成!", 48, "信息提示"
    Call ClearData
End Sub

Private Sub cmdImportPic_Click()
    On Error GoTo nofile
    comDialog.InitDir = App.Path & "\picture"
    comDialog.Filter = " Gif 文件 | *.Gif | Jpg 文件 | *.Jpg | 所有文件 | *.*"
    comDialog.CancelError = False
    comDialog.ShowOpen
    imgProduct.Picture = LoadPicture(comDialog.FileName)
    Exit Sub
nofile:
    If Err.Number = 32755 Then
        MsgBox "放弃操作!", 48, "信息提示"
    Else
        MsgBox "其他操作!", 48, "信息提示"
    End If
End Sub

Private Sub cmdModi_Click()
On Error GoTo errhandle
    If CheckData() = False Then Exit Sub
    Adodc1.Recordset.Fields("productid") = txtId
    Adodc1.Recordset.Fields("productname") = txtName
    Adodc1.Recordset.Fields("instocktime") = DTPDate.Value & " " & DTPTime.Value
    Adodc1.Recordset.Fields("number") = txtNumber
    Adodc1.Recordset.Fields("jinhuoprice") = txtPriceIn
    Adodc1.Recordset.Fields("marketprice") = txtMarketPrice
    Adodc1.Recordset.Fields("lowestprice") = txtLowest
    Adodc1.Recordset.Fields("picture") = comDialog.FileName
    Adodc1.Recordset.Fields("remainNumber") = txtNumber
    Adodc1.Recordset.Fields("TreeSort") = txtTreeSort
    Adodc1.Recordset.Update
    MsgBox "成功更新该产品信息,操作完成!", 48, "信息提示"
    Call ClearData
    Exit Sub
errhandle:
   If Err.Number = -2147467259 Then
        MsgBox "产品编号必须唯一,请重新输入产品编号!", 48, "信息提示"
        txtId.SetFocus
   End If
End Sub

Private Sub DataGrid1_RowColChange(LastRow As Variant, ByVal LastCol As Integer)
    txtId = Adodc1.Recordset.Fields("productid")
    txtName = Adodc1.Recordset.Fields("productname")
    s = Split(Adodc1.Recordset.Fields("instocktime"), " ")
    DTPDate.Value = s(0)
    DTPTime.Value = s(1)
    txtNumber = Adodc1.Recordset.Fields("number")
    txtPriceIn = Adodc1.Recordset.Fields("jinhuoprice")
    txtMarketPrice = Adodc1.Recordset.Fields("marketprice")
    txtLowest = Adodc1.Recordset.Fields("lowestprice")
    imgProduct.Picture = LoadPicture(Adodc1.Recordset.Fields("picture"))
    comDialog.FileName = Adodc1.Recordset.Fields("picture")
    txtTreeSort.Text = Adodc1.Recordset.Fields("TreeSort")
End Sub

Private Sub Form_Load()
    DTPDate.Value = Date
    DTPTime.Value = Time
    Adodc1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & dbFile & ";Persist Security Info=False"
    Adodc1.CommandType = adCmdTable
    Adodc1.RecordSource = "product"
'Adodc1.Refresh
    Set DataGrid1.DataSource = Adodc1
    
    InstockFlag = True '入库窗口打开标志
End Sub

Private Sub Form_Terminate()
    InstockFlag = False
End Sub

⌨️ 快捷键说明

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