Hello there guys!
I need your vb6 expertise. I have a feature of my program with the quantity. What i want is i need a warning message if the quantity is lesser than the minimum quantity for example the minimum of 5 quantity. In my code it will reach to zero quantity before got the warning.
Private Sub txtqty_Change()
On Error GoTo txtqty_change_error:
Connection
Set rs = New ADODB.Recordset
SQL = "SELECT qty FROM tblstocks WHERE Category_Description LIKE '%" & Replace(Trim(lblx), "'", "''") & "%' ORDER BY Category_Description"
' Percentage (%) sign is used as a wildcard character in the "LIKE" clause.
rs.Open SQL, cn, 3, 3
If Val(txtqty.Text) > rs!Qty Then
MsgBox "Insuffecient Quantity of Stock", vbExclamation, ""
txtqty.SetFocus
ElseIf txtqty.Text = "" Then
txtcost.Text = Val(txtcost.Text) - Val(Text11.Text)
Else
Text11 = Val(txtqty.Text) * Val(txtamount.Text)
Text2.Text = Val(txtqty.Text) * Val(txtamount.Text)
If txtqty.Text > Text4.Text Then
Text9.Text = Val(Text8.Text) - Val(txtqty.Text)
ElseIf txtqty.Text < Text4.Text Then
Text9.Text = Val(Text8.Text) - Val(txtqty.Text)
ElseIf txtqty.Text = Text4.Text Then
Text9.Text = Val(Text8.Text) - Val(Text4.Text)
End If
End If
Exit Sub
txtqty_change_error:
MsgBox err.Description & " _ " & err.Number & ".", vbCritical
End Sub