Results 1 to 8 of 8
  1. #1
    Business is offline Advanced Beginner
    Windows 8 Access 2010 64bit
    Join Date
    Apr 2016
    Posts
    78

    Making a label change color when getting to a minimum


    Hi,
    I got a table Stock where i do set a minimum for products.And from the invoice form i got a label. I would like this label to turn to red when the minimum is reached. How do i go about it

    Regards

  2. #2
    CJ_London is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,412
    I presume this is on a single form?

    labels cannot be conditionally formatted so you would need use some vba code - which will only work on a single form

    Code:
    if myControl<someminimum then myLabel.Backcolor=vbRed
    where you put this code depends on when you want it to fire - if when you open the form, use the form current event, if after a user has entered a value which takes it below the minimum then that control after update event - or perhaps both

  3. #3
    Business is offline Advanced Beginner
    Windows 8 Access 2010 64bit
    Join Date
    Apr 2016
    Posts
    78
    I did what you have said but its like the program does not recognize minimum.I guess that minimum has to be taken from the stock table.As you can see in the code
    If Me.Texte15.Value < minimum ThenMe.Texte30.BackColor = vbRed
    It does not get the set minimum of the product


    End If

  4. #4
    CJ_London is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,412
    you guess right!

  5. #5
    Business is offline Advanced Beginner
    Windows 8 Access 2010 64bit
    Join Date
    Apr 2016
    Posts
    78
    So how do i go about it then

  6. #6
    CJ_London is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,412
    you could perhaps bring it in with the stock record or use a dlookup, but without knowing your table structure and relationships and how your form is designed I've no idea whether that is feasible

  7. #7
    Business is offline Advanced Beginner
    Windows 8 Access 2010 64bit
    Join Date
    Apr 2016
    Posts
    78
    There is a table stock(stockid,stockname,stockQuantite,minimum) and the table invoice(invoiceId,stockid,invoiceDate,quantiteSort i,total).Then i made up a form invoice with a small label that has to change color.hoz do i use the DLook

  8. #8
    CJ_London is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,412
    here is a link to dlookup - the expression will be the minimum value, the table will be stock, and the criteria will use the stockid

    https://support.office.com/en-us/art...b-bed10dca5937

Please reply to this thread with any new information or opinions.

Similar Threads

  1. change tab color or header color
    By witz07 in forum Access
    Replies: 6
    Last Post: 03-31-2016, 05:31 PM
  2. Changing font color of just part of a label
    By NGFLNG1 in forum Access
    Replies: 3
    Last Post: 09-11-2015, 11:02 AM
  3. Making two label captions the same
    By thebionicredneck2003 in forum Forms
    Replies: 10
    Last Post: 05-10-2013, 01:54 PM
  4. Replies: 5
    Last Post: 09-18-2012, 12:39 PM
  5. Replies: 1
    Last Post: 03-29-2009, 08:27 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums