Hi there,
you could try using the Form_current() event. It runs every time you
move to a new record. In the Form_current() event you could check the
value of the 'quantity' field. If you include a field/control on the
form that contains the minimum stock value for that record/stock item,
then you could check the current value of quantity against the minimum
quantity value
for example:
Private Sub Form_Current()
Dim lngRed As Long
Dim lngBlack As Long
lngBlack = RGB(0, 0, 0)
lngRed = RGB(255, 0, 0)
If Me.Quantity < Me.Minimum_Stock Then
Me.Quantity.ForeColor = lngRed
Else
Me.Quantity.ForeColor = lngBlack
End If
End Sub
you have to use the RGB function to return a long number specifying
the different colors. You also have to set the forecolor to return to
black if the value is above the minimum amount,
hope this helps!
peace,
David Thomas.
matx3001 (AT) hotmail (DOT) com (matx) wrote in message news:<bc8d0f0d.0405190454.d995425 (AT) posting (DOT) google.com>...
Quote:
hi,
I am making a stock control database in access.
I have created a table that shows the stock. But i want to compare it
with the minimun stock set in my database. If the stock is lower then
i want to change the text colour to RED
below is my attempt to do it but it didnt work. i am doing this is a
form which displays all the items in my dataabse. This is run when
the databse is opened.
Private Sub Quantity_Enter()
If (quantity.Value < Minimum_Stock.Value) Then
quantity.ForeColor = acColorIndexRed
End Sub
I dont really know VB but i program in java. VB dont detect any bugs
with the code.
thanks in advance |