dbTalk Databases Forums  

make text change colour.

comp.database.ms-access comp.database.ms-access


Discuss make text change colour. in the comp.database.ms-access forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
matx
 
Posts: n/a

Default make text change colour. - 05-19-2004 , 07:54 AM






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

Reply With Quote
  #2  
Old   
David Thomas
 
Posts: n/a

Default Re: make text change colour. - 05-27-2004 , 06:53 AM






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

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.