Results 1 to 6 of 6
  1. #1
    kiri19 is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Aug 2012
    Location
    Ottawa, Canada
    Posts
    18

    Change label color when the field is not null


    I would like to change the Background color of the label to Red when Notes is not empty in the table, this is when a combobox autopopulate the fields in the form.
    The Notes textfield opens when the label is clicked on, this works, but the Background color of the label does not turn Red when there is a note.

    Private Sub Form_Current()
    Notes.Visible = False
    If IsNull(Me.Notes.Value) = True Then
    Me.notelabel.BackColor = vbWhite
    Else
    Me.notelabel.BackColor = vbRed
    End If
    End Sub


    Private Sub notelabel_Click()
    Notes.Visible = True
    End Sub

  2. #2
    Missinglinq's Avatar
    Missinglinq is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    3,018
    By default, the Back Style Property of a Label is set to Transparent. Right-Click on the Label and Click on Properties. Now Click on the Format Tab and set the Back Style Property to Normal and your code should work.

    Linq ;0)>
    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

  3. #3
    kiri19 is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Aug 2012
    Location
    Ottawa, Canada
    Posts
    18
    Thanks, looks like i need to get ms access books to read, there are a lot of things i dont know

  4. #4
    Missinglinq's Avatar
    Missinglinq is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    3,018
    Unfortunately, the PR department in Redmond has hawked the idea for years that MS Access is so easy to use that anyone can develop a Database! This is probably true, if you want to run up a Database to keep track of your Christmas card recipients, or a membership db for the local PTA, but not for any serious app! It is especially unfortunate because the 'suits' in companies read it and assume that it is true! They ask someone, usually a junior member of the firm, if they have any experience or if they've taken any classes in Access, and they respond with a 'yes.' Then they request a Database that would take an experienced developer a month to complete!

    Yes, get a book, watch some videos, several times, and scour the internet!

    Here's some sites, listed from the easiest to understand to the more difficult, that go into the nuts and bolts of development, after you get a handle of table design.

    Chrystal has an excellent “basics” tutorial:

    http://www.accessmvp.com/strive4peace

    This is a little more advanced, but still a great starting point, having 28 well written, well defined, clearly named chapters.
    :
    http://www.functionx.com/vbaccess/index.htm

    Jeff Conrad's resources page:
    http://www.accessmvp.com/JConrad/acc...resources.html

    The Access Web resources page:
    http://www.mvps.org/access/resources/index.html

    MVP Allen Browne's extensive list of tutorials and on-line reference materials:
    http://allenbrowne.com/links.html#Tutorials

    And the first thing to do is to learn the ABCs, literally! Learn the names of the Objects! What a Form is, what a Field is, what a Control is, and the difference between the last two.

    One of the biggest problems we face, here, and on other Access forums, are newbies who can't ask an intelligent question simply because they don't know the proper words to use!

    And continue to ask questions, as you've done, here!

    Good luck with your project!

    Linq ;0)>
    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

  5. #5
    kiri19 is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Aug 2012
    Location
    Ottawa, Canada
    Posts
    18
    Thanks for the links

  6. #6
    Missinglinq's Avatar
    Missinglinq is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    3,018
    Glad we could help with your problem, and always happy to help anyone who wants to learn!

    Linq ;0)>
    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

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

Similar Threads

  1. Change font color in Query
    By Brian62 in forum Queries
    Replies: 2
    Last Post: 01-10-2013, 09:14 PM
  2. Replies: 8
    Last Post: 04-26-2012, 10:13 AM
  3. Replies: 1
    Last Post: 03-29-2009, 08:27 AM
  4. change cell color
    By bishop743 in forum Programming
    Replies: 0
    Last Post: 02-01-2009, 11:00 AM
  5. Change of label size
    By Zoroxeus in forum Programming
    Replies: 0
    Last Post: 06-11-2007, 08:18 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