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

📄 frmaddhuo.frm

📁 一个用VB写的服装进销存源码
💻 FRM
字号:
VERSION 5.00
Begin VB.Form frmaddhuo 
   BorderStyle     =   3  'Fixed Dialog
   Caption         =   "添加货品资料"
   ClientHeight    =   4785
   ClientLeft      =   45
   ClientTop       =   405
   ClientWidth     =   7785
   Icon            =   "frmaddhuo.frx":0000
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   4785
   ScaleWidth      =   7785
   ShowInTaskbar   =   0   'False
   StartUpPosition =   2  '屏幕中心
   Begin VB.TextBox txtbak 
      Height          =   1095
      Left            =   120
      TabIndex        =   8
      Top             =   2760
      Width           =   7575
   End
   Begin VB.Frame Frame1 
      Caption         =   "主要信息"
      Height          =   2295
      Left            =   120
      TabIndex        =   13
      Top             =   120
      Width           =   7575
      Begin VB.TextBox txtRukujia 
         Height          =   270
         Left            =   4200
         TabIndex        =   7
         Top             =   1800
         Width           =   1695
      End
      Begin VB.ComboBox cmb 
         Height          =   300
         Index           =   1
         Left            =   4200
         TabIndex        =   3
         Top             =   840
         Width           =   1695
      End
      Begin VB.TextBox txthNum 
         Height          =   270
         Left            =   960
         TabIndex        =   6
         Top             =   1800
         Width           =   1935
      End
      Begin VB.ComboBox cmb 
         Height          =   300
         Index           =   0
         Left            =   960
         TabIndex        =   0
         Top             =   360
         Width           =   1935
      End
      Begin VB.TextBox txthNo 
         Height          =   270
         Left            =   4200
         TabIndex        =   1
         Tag             =   "从业资格证"
         Top             =   360
         Width           =   1695
      End
      Begin VB.TextBox txthName 
         Height          =   270
         Left            =   960
         TabIndex        =   4
         Tag             =   "身份证号"
         Top             =   1320
         Width           =   1935
      End
      Begin VB.TextBox txthGuige 
         Height          =   270
         Left            =   960
         TabIndex        =   2
         Tag             =   "驾驶证号"
         Top             =   840
         Width           =   1935
      End
      Begin VB.ComboBox cmb 
         Height          =   300
         HelpContextID   =   2
         Index           =   2
         Left            =   4200
         TabIndex        =   5
         Tag             =   "准驾车型"
         Top             =   1320
         Width           =   1695
      End
      Begin VB.Label Label5 
         AutoSize        =   -1  'True
         Caption         =   "入库价:"
         Height          =   180
         Left            =   3360
         TabIndex        =   21
         Top             =   1800
         Width           =   630
      End
      Begin VB.Label Label12 
         AutoSize        =   -1  'True
         Caption         =   "货品品牌:"
         Height          =   180
         Left            =   3360
         TabIndex        =   20
         Top             =   1320
         Width           =   810
      End
      Begin VB.Label Label8 
         AutoSize        =   -1  'True
         Caption         =   "货品数量:"
         Height          =   180
         Left            =   120
         TabIndex        =   19
         Top             =   1800
         Width           =   810
      End
      Begin VB.Label Label1 
         AutoSize        =   -1  'True
         Caption         =   "货品类别:"
         Height          =   180
         Left            =   120
         TabIndex        =   18
         Tag             =   "司机编号"
         Top             =   360
         Width           =   810
      End
      Begin VB.Label Label2 
         AutoSize        =   -1  'True
         Caption         =   "货品编码:"
         Height          =   180
         Left            =   3360
         TabIndex        =   17
         Tag             =   "从业资格证"
         Top             =   360
         Width           =   810
      End
      Begin VB.Label Label3 
         AutoSize        =   -1  'True
         Caption         =   "货品名称:"
         Height          =   180
         Left            =   120
         TabIndex        =   16
         Tag             =   "身份证号"
         Top             =   1320
         Width           =   810
      End
      Begin VB.Label Label4 
         AutoSize        =   -1  'True
         Caption         =   "货品规格:"
         Height          =   180
         Left            =   120
         TabIndex        =   15
         Tag             =   "驾驶证号"
         Top             =   840
         Width           =   810
      End
      Begin VB.Label Label6 
         AutoSize        =   -1  'True
         Caption         =   "货品单位:"
         Height          =   180
         Left            =   3360
         TabIndex        =   14
         Tag             =   "准驾车型"
         Top             =   840
         Width           =   810
      End
   End
   Begin VB.Frame Frame3 
      Height          =   735
      Left            =   120
      TabIndex        =   12
      Top             =   3960
      Width           =   7575
      Begin VB.CommandButton cmdadd 
         Caption         =   "添加(&M)"
         Height          =   375
         Left            =   3960
         TabIndex        =   9
         Top             =   240
         Width           =   1095
      End
      Begin VB.CommandButton cmdqing 
         Caption         =   "清空(&Q)"
         Height          =   375
         Left            =   5160
         TabIndex        =   10
         Top             =   240
         Width           =   1095
      End
      Begin VB.CommandButton cmdclose 
         Caption         =   "关闭(&C)"
         Height          =   375
         Left            =   6360
         TabIndex        =   11
         Top             =   240
         Width           =   1095
      End
   End
   Begin VB.Label Label11 
      AutoSize        =   -1  'True
      Caption         =   "备注:"
      Height          =   180
      Left            =   120
      TabIndex        =   22
      Top             =   2520
      Width           =   450
   End
End
Attribute VB_Name = "frmaddhuo"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
Private Sub cmb_KeyPress(Index As Integer, KeyAscii As Integer) '响应回车事件
    If Trim(cmb(0).Text) <> "" And KeyAscii = 13 Then
        txthNo.SetFocus
    End If
    If Trim(cmb(1).Text) <> "" And KeyAscii = 13 Then
        txthName.SetFocus
    End If
    If Trim(cmb(2).Text) <> "" And KeyAscii = 13 Then
        txthNum.SetFocus
    End If
End Sub
Private Sub cmdclose_Click()
    Unload Me
End Sub
'
Private Sub qing() '定义清空内容选项
    cmb(0).Text = ""
    cmb(1).Text = ""
    cmb(2).Text = ""
    txthNo.Text = ""
    txthGuige.Text = ""
    txthName.Text = ""
    txthNum.Text = ""
    txtRukujia.Text = ""
    txtbak.Text = ""
End Sub
Private Sub cmdqing_Click() '定义清函数
    Call qing
End Sub
Private Sub Form_Load()
    Dim rs As New ADODB.Recordset
    rs.open "select * from leibie", cn
    cmb(0).Clear
    Do While Not rs.EOF
        cmb(0).AddItem rs!leibie
        rs.MoveNext
    Loop
    rs.Close
    rs.open "select * from danwei", cn
    cmb(1).Clear
    Do While Not rs.EOF
        cmb(1).AddItem rs!danwei
        rs.MoveNext
    Loop
    rs.Close
    rs.open "select * from pinpai", cn
    cmb(2).Clear
    Do While Not rs.EOF
        cmb(2).AddItem rs!pinpai
        rs.MoveNext
    Loop
    rs.Close
End Sub
Private Sub cmdadd_Click() '定义添加按钮功能
    Dim sql As String
    Dim rs2 As New ADODB.Recordset
    Dim sql2 As String
    
    Dim rs As New ADODB.Recordset
        If Trim(cmb(0).Text) = "" Then
        MsgBox "货品类别不能为空!", 48, "信息提示"
        cmb(0).SetFocus
        Exit Sub
    End If
    If Trim(txthNo.Text) = "" Then
        MsgBox "货品编码不能为空!", 48, "信息提示"
        txthNo.SetFocus
        Exit Sub
    End If
    If Trim(cmb(1).Text) = "" Then
        MsgBox "货品单位不能为空!", 48, "信息提示"
        cmb(1).SetFocus
        Exit Sub
    End If
    If Trim(txthName.Text) = "" Then
        MsgBox "货品名称不能为空!", 48, "信息提示"
        txthName.SetFocus
        Exit Sub
    End If
    If Trim(cmb(2).Text) = "" Then
        MsgBox "货品品牌不能为空!", 48, "信息提示"
        cmb(2).SetFocus
        Exit Sub
    End If
    If Trim(txtRukujia.Text) = "" Then
        MsgBox "入库价不能为空!", 48, "信息提示"
        txtRukujia.SetFocus
        Exit Sub
    End If
   
    '写入数据库
     sql = "select " & HUOPIN_TABLE_STR1 & " from Huopin where hNo='" & Trim(txthNo.Text) & "'" 'HUOPIN_TABLE_STR是字段列表
    rs.open sql, cn, adOpenDynamic, adLockOptimistic
    If rs.RecordCount > 0 Then
        MsgBox "已经存在编号[" & txthNo.Text & "]的货物,如果您确实需要输入,请选择进货单。", 48, "提示信息"
        txthNo.SetFocus
        Exit Sub
    End If
    rs.AddNew
    rs!hNo = Trim(txthNo.Text)
    rs!hName = Trim(txthName.Text)
    rs!hGuige = Trim(txthGuige.Text)
    rs!hRukujia = Trim(txtRukujia.Text)
'    rs!hXiaojia = Trim(txtXiaojia.Text)
'    rs!hRen = Trim(txthRen.Text)
    rs!hLeibie = Trim(cmb(0).Text)
    rs!hDanwei = Trim(cmb(1).Text)
    rs!hNum = Trim(txthNum.Text)
    rs!hPinpai = Trim(cmb(2).Text)
    rs!jiecun = rs!hNum * rs!hRukujia
    
    If Trim(txtbak.Text) <> "" Then
        rs!hbak = Trim(txtbak.Text)
        Else
        rs!hbak = "有待添加中..."
    End If
    rs.Update

    rs.Update
    MsgBox "记录添加成功!", 48, "信息提示"
    Call qing
    cmb(0).SetFocus
End Sub



Private Sub txthGuige_KeyPress(KeyAscii As Integer)
    If Trim(txthGuige.Text) <> "" And KeyAscii = 13 Then
        cmb(1).SetFocus
        Exit Sub
    End If
End Sub

Private Sub txthName_KeyPress(KeyAscii As Integer)
    If Trim(txthName.Text) <> "" And KeyAscii = 13 Then
        cmb(2).SetFocus
        Exit Sub
    End If
End Sub

Private Sub txthNo_KeyPress(KeyAscii As Integer)
    If Trim(txthNo.Text) <> "" And KeyAscii = 13 Then
        txthGuige.SetFocus
        Exit Sub
    End If
End Sub

Private Sub txthNum_KeyPress(KeyAscii As Integer)
    If Trim(txthNum.Text) <> "" And KeyAscii = 13 Then
        txtRukujia.SetFocus
        Exit Sub
    End If
End Sub

Private Sub txtRukujia_KeyPress(KeyAscii As Integer) '限制数字内容输入
    If Trim(txtRukujia.Text) <> "" And KeyAscii = 13 Then
        txtbak.SetFocus
        Exit Sub
    End If
    If KeyAscii = 8 Then
       Exit Sub
    End If
    If InStr("0123456789.", Chr(KeyAscii)) <= 0 Then
       KeyAscii = 0
    End If
End Sub

⌨️ 快捷键说明

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