Function InvCountEnter(PartNo As String, Qty As Integer) As Integer
Dim ProdGen As ADODB.Recordset
Dim sql As String
Dim val As Long
Set ProdGen = CurrentProject.Connection.Execute("Select * From SCGNMATL Where PartNo = '" & PartNo & "'")
If ProdGen.EOF Then
Beep
MsgBox " Part not found", 48, "Invalid Data"
InvCountEnter = False
Else
val = ProdGen.Fields("PartReady").Value - Qty
sql = "UPDATE SCGNMATL SET PartReady = " & val & " Where PartNo = '" & PartNo & "'"
CurrentProject.Connection.Execute sql
InvCountEnter = True
End If
ProdGen.Close
Set ProdGen = Nothing
End Function
|