?? chukuxiugai.frm
字號:
VERSION 5.00
Object = "{86CF1D34-0C5F-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCT2.OCX"
Begin VB.Form chukuxiugai
Caption = "出庫記錄修改"
ClientHeight = 7620
ClientLeft = 60
ClientTop = 465
ClientWidth = 10605
LinkTopic = "Form1"
ScaleHeight = 7620
ScaleWidth = 10605
StartUpPosition = 3 '窗口缺省
Begin VB.TextBox Text3
Enabled = 0 'False
Height = 270
Left = 8520
TabIndex = 19
Top = 2880
Width = 975
End
Begin VB.ListBox List1
Height = 2220
Left = 7800
TabIndex = 17
Top = 3480
Width = 1935
End
Begin VB.Frame Frame2
Caption = "待修改批次"
Height = 735
Left = 8400
TabIndex = 16
Top = 2520
Width = 1335
End
Begin VB.TextBox Text1
Enabled = 0 'False
Height = 270
Left = 8520
TabIndex = 15
Top = 2760
Width = 975
End
Begin VB.ComboBox Combo1
Height = 300
Left = 4800
TabIndex = 7
Top = 480
Width = 1695
End
Begin VB.ComboBox Combo2
Height = 300
Left = 7920
TabIndex = 6
Top = 480
Width = 1695
End
Begin VB.TextBox Text2
Height = 375
Left = 5760
TabIndex = 5
Top = 1800
Width = 1695
End
Begin VB.ComboBox Combo3
Height = 300
Left = 1800
TabIndex = 4
Top = 1800
Width = 1695
End
Begin VB.Frame Frame1
Caption = "提示"
Height = 2655
Left = 600
TabIndex = 2
Top = 2880
Width = 6375
Begin VB.Label Label10
Caption = "型號一欄填入要修改的產品型號,如果這一天有多次入庫,注意選擇批次"
Height = 375
Left = 240
TabIndex = 22
Top = 840
Width = 5895
End
Begin VB.Label Label9
Caption = "注意:灰色字體的待修改批次才是真正要修改的批次"
ForeColor = &H00FF0000&
Height = 375
Left = 240
TabIndex = 21
Top = 1320
Width = 4335
End
Begin VB.Label Label11
Caption = "只有選中列表中的批次才能夠對產品進行修改"
Height = 375
Left = 240
TabIndex = 20
Top = 1800
Width = 3975
End
Begin VB.Label Label5
Caption = "注意輸入合理的數值"
Height = 375
Left = 240
TabIndex = 3
Top = 360
Width = 4215
End
End
Begin VB.CommandButton Command1
Caption = "修 改"
Height = 1095
Left = 1200
TabIndex = 1
Top = 6240
Width = 2415
End
Begin VB.CommandButton Command2
Caption = "退 出"
Height = 1095
Left = 6360
TabIndex = 0
Top = 6240
Width = 2775
End
Begin MSComCtl2.DTPicker DTPicker1
Height = 375
Left = 1800
TabIndex = 8
Top = 480
Width = 1815
_ExtentX = 3201
_ExtentY = 661
_Version = 393216
Format = 25493505
CurrentDate = 39232
End
Begin VB.Label Label8
Caption = "批次:"
Height = 375
Left = 7680
TabIndex = 18
Top = 3000
Width = 735
End
Begin VB.Label Label1
Caption = "產品分類"
Height = 375
Left = 3960
TabIndex = 14
Top = 480
Width = 735
End
Begin VB.Label Label2
Caption = "品牌"
Height = 375
Left = 7080
TabIndex = 13
Top = 480
Width = 735
End
Begin VB.Label Label3
Caption = "型號"
Height = 375
Left = 960
TabIndex = 12
Top = 1800
Width = 1215
End
Begin VB.Label Label4
Caption = "數量"
Height = 375
Left = 5040
TabIndex = 11
Top = 1800
Width = 1095
End
Begin VB.Label Label6
Caption = "出庫日期"
Height = 375
Left = 720
TabIndex = 10
Top = 480
Width = 1095
End
Begin VB.Label Label7
Caption = "修改成功"
BeginProperty Font
Name = "宋體"
Size = 21.75
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H000000FF&
Height = 615
Left = 7800
TabIndex = 9
Top = 1680
Visible = 0 'False
Width = 2055
End
End
Attribute VB_Name = "chukuxiugai"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
If Combo1.Text = "" Or Combo2.Text = "" Or Combo3.Text = "" Or Text2 = "" Or Text3 = "" Or Not IsNumeric(Text3) Or Not IsNumeric(Text2) Or Text2 < 1 Then
Exit Sub
Else
Dim rst As Recordset
Dim db As Connection
Set rst = New Recordset
' Set rs2 = New Recordset
Set db = New Connection
conn = "select * from 產品類別 where 類別名稱 ='" & Combo1 & "'"
db.CursorLocation = adUseClient
db.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=Database.mdb;Persist Security Info=False"
rst.Open conn, db, adOpenDynamic, adLockOptimistic
If Not rst.EOF Then
aaa = rst.Fields("id")
Else
X = MsgBox("是否添加新類別:" & Combo1.Text & "?", vbOKCancel)
If X = 1 Then
conn = "insert into 產品類別(類別名稱) values ('" & Combo1 & "')"
rst.Close
rst.Open conn, db, adOpenDynamic, adLockOptimistic
MsgBox "類別添加成功"
conn = "select * from 產品類別 where 類別名稱 ='" & Combo1 & "'"
rst.Open conn, db, adOpenDynamic, adLockOptimistic
aaa = rst.Fields("id")
Else
Exit Sub
End If
End If
rst.Close
conn = "select * from 生產廠家 where 品牌 ='" & Combo2 & "'"
rst.Open conn, db, adOpenDynamic, adLockOptimistic
If Not rst.EOF Then
bbb = rst.Fields("id")
Else
X = MsgBox("是否添加新品牌:" & Combo2.Text & "?", vbOKCancel)
If X = 1 Then
conn = "insert into 生產廠家(品牌) values ('" & Combo2 & "')"
rst.Close
rst.Open conn, db, adOpenDynamic, adLockOptimistic
MsgBox "品牌添加成功"
conn = "select * from 生產廠家 where 品牌 ='" & Combo2 & "'"
rst.Open conn, db, adOpenDynamic, adLockOptimistic
bbb = rst.Fields("id")
Else
Exit Sub
End If
End If
rst.Close
conn = "select * from 產品庫存 where 生產廠家=" & bbb & " and 產品類別=" & aaa & " and 產品型號='" & Combo3 & "'"
rst.Open conn, db, adOpenDynamic, adLockOptimistic
If rst.EOF Then
MsgBox "無此產品"
Exit Sub
Else
rst.MoveFirst
ccc = rst.Fields("數量")
ddd = 0
'Debug.Print ccc & "ccc"
rst.MoveNext
Do Until rst.EOF
ccc = ccc + rst.Fields("數量")
rst.MoveNext
Loop
rst.Close
conn = "select * from 產品出庫 where 生產廠家=" & bbb & " and 產品類別=" & aaa & " and 產品型號='" & Combo3 & "'"
rst.Open conn, db, adOpenDynamic, adLockOptimistic
If Not rst.EOF Then
rst.MoveFirst
ddd = rst.Fields("數量")
rst.MoveNext
Do Until rst.EOF
ddd = ddd + rst.Fields("數量")
rst.MoveNext
Loop
End If
End If
rst.Close
conn = "select * from 產品出庫 where id=" & Text3
rst.Open conn, db, adOpenDynamic, adLockOptimistic
eee = rst.Fields("數量")
rst.Close
'Debug.Print ddd
'Debug.Print eee
If CInt(Text2) > (ccc - ddd + eee) Then
MsgBox "出貨大于庫存,請檢查輸入"
Exit Sub
End If
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -