-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfrmChangeStock.frm
More file actions
180 lines (173 loc) · 5.72 KB
/
frmChangeStock.frm
File metadata and controls
180 lines (173 loc) · 5.72 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
VERSION 5.00
Begin VB.Form frmChangeStock
BorderStyle = 1 'Fixed Single
Caption = "Change Stock"
ClientHeight = 2910
ClientLeft = 45
ClientTop = 390
ClientWidth = 4620
Icon = "frmChangeStock.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 2910
ScaleWidth = 4620
StartUpPosition = 3 'Windows Default
Begin VB.Frame frameStock
BorderStyle = 0 'None
Caption = "Frame1"
Height = 2895
Left = 0
TabIndex = 0
Top = 0
Width = 4575
Begin VB.CheckBox chkOutOfStock
Caption = "Out of Stock?"
BeginProperty Font
Name = "Consolas"
Size = 12
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 360
TabIndex = 6
Top = 1440
Width = 2535
End
Begin VB.CommandButton cmdAccept
Caption = "Change &Stock"
BeginProperty Font
Name = "Consolas"
Size = 12
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 615
Left = 960
TabIndex = 5
Top = 2040
Width = 2535
End
Begin VB.TextBox txtNewStock
BeginProperty Font
Name = "Consolas"
Size = 12
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 2640
TabIndex = 4
Top = 840
Width = 1695
End
Begin VB.TextBox txtCurrentStock
BeginProperty Font
Name = "Consolas"
Size = 12
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 2640
TabIndex = 2
Top = 120
Width = 1695
End
Begin VB.Label lblNewStock
Caption = "New Stock:"
BeginProperty Font
Name = "Consolas"
Size = 12
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 360
TabIndex = 3
Top = 960
Width = 2295
End
Begin VB.Label lblCurrent
Caption = "Current Stock:"
BeginProperty Font
Name = "Consolas"
Size = 12
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 360
TabIndex = 1
Top = 240
Width = 2175
End
End
End
Attribute VB_Name = "frmChangeStock"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub chkOutOfStock_Click()
If chkOutOfStock.value <> 0 Then txtNewStock.Enabled = False
End Sub
Private Sub cmdAccept_Click()
If txtNewStock = "" And chkOutOfStock.value = 0 Then
MsgBox "Enter a valid amount", vbExclamation, "Information"
Exit Sub
End If
If MsgBox("Do you really want to change the Stock of this model?", vbYesNo + vbQuestion, "Confirmation") = vbYes Then
If chkOutOfStock.value <> 0 Then
rs3.Fields!Quantity = 0
Else
rs3.Fields!Quantity = FormatNumber(txtNewStock, 0)
End If
rs3.Update
MsgBox "Stock changed successfully!", vbInformation, "Information"
Unload Me
End If
End Sub
Public Sub LoadQuery(query As String)
ExecuteSQL3 query
txtCurrentStock = rs3.Fields!Quantity
txtCurrentStock.Enabled = False
End Sub
Private Sub txtCurrentStock_LostFocus()
txtCurrentStock = Format(txtCurrentStock, "#,###")
End Sub
Private Sub txtNewStock_GotFocus()
If txtNewStock <> "" Then txtNewStock.Text = FormatNumber(txtNewStock, 0)
End Sub
Private Sub txtNewStock_KeyPress(KeyAscii As Integer)
VerifyChar KeyAscii
End Sub
Private Sub txtNewStock_LostFocus()
If Len(txtNewStock) Mod 3 = 0 Then txtNewStock.MaxLength = 7
txtNewStock = Format(txtNewStock, "#,###")
End Sub
Sub VerifyChar(KeyAscii As Integer)
If Not IsNumeric(Chr(KeyAscii)) And Not KeyAscii = 8 Then
KeyAscii = 0
MsgBox "Enter only numeric characters!", vbInformation, "Information"
End If
End Sub