restfern
10-26-2000, 06:00 PM
I have been trying for ages to write a sub that runs through the values of a specific field , "currentlevel" and compares it with the value of "reorderlevel".
However, I can't get it to work. Here's the code I'm using:
Sub CheckLevel()
Current = CDec(Data1.Recordset.Fields("CurrentLevel").Value)
Reorder = CDec(Data1.Recordset.Fields("ReorderLevel").Value)
Data1.Recordset.MoveFirst
While Not Data1.Recordset.EOF
If Current < Reorder Then
lblWarning.Caption = "Low Stock Warning!"
Exit Sub
Else
lblWarning.Caption = "Product Stock Level okay"
End If
Data1.Recordset.MoveNext
Wend
Data1.Recordset.MoveFirst
End Sub
If anybody can help I'd be greatly appreciative. Thanks
Knows a little about a lot
However, I can't get it to work. Here's the code I'm using:
Sub CheckLevel()
Current = CDec(Data1.Recordset.Fields("CurrentLevel").Value)
Reorder = CDec(Data1.Recordset.Fields("ReorderLevel").Value)
Data1.Recordset.MoveFirst
While Not Data1.Recordset.EOF
If Current < Reorder Then
lblWarning.Caption = "Low Stock Warning!"
Exit Sub
Else
lblWarning.Caption = "Product Stock Level okay"
End If
Data1.Recordset.MoveNext
Wend
Data1.Recordset.MoveFirst
End Sub
If anybody can help I'd be greatly appreciative. Thanks
Knows a little about a lot