Results 1 to 6 of 6
  1. #1
    data808 is offline Noob
    Windows 8 Access 2007
    Join Date
    Aug 2012
    Posts
    727

    VBA to change font color


    I have the following code below for a label that changes its caption. Does anyone know how to change the "Adding New Record" caption to red color font? What would I have to add to this code to make it happen? I only want the font to change color when it says "Adding New Record".



    If Me.NewRecord Then
    Me.lblRecordCounter.Caption = "Adding New Record"
    Else
    Me.lblRecordCounter.Caption = _
    "Record " & Me.CurrentRecord & " of " & Me.Recordset.RecordCount
    End If


    Thanks.

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,601
    That is the Forecolor property.

    Me.lblRecordCounter.ForeColor = vbRed
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    data808 is offline Noob
    Windows 8 Access 2007
    Join Date
    Aug 2012
    Posts
    727
    Thanks June7. Worked like a charm but then I decided to go with "vbGreen" and was not satisfied with the shade of green it gave me. How do I make it a darker green?

  4. #4
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,601
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  5. #5
    data808 is offline Noob
    Windows 8 Access 2007
    Join Date
    Aug 2012
    Posts
    727
    Thanks. I actually did something similar today but couldn't get it to work. I did it wrong. I did this:

    me.lblRecordCount.Forecolor = vbGreen (RGB 0, 146, 0)

    I now know that I was not supposed to add the vbGreen.

    Thanks for the help.

  6. #6
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,601
    me.lblRecordCount.Forecolor = RGB(0, 146, 0)
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

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

Similar Threads

  1. How to change font color in a form?
    By Jamesiv1 in forum Access
    Replies: 6
    Last Post: 05-16-2014, 03:24 PM
  2. Change font color in Query
    By Brian62 in forum Queries
    Replies: 2
    Last Post: 01-10-2013, 09:14 PM
  3. Change font color in subform
    By rtrinidad in forum Forms
    Replies: 1
    Last Post: 11-04-2012, 01:42 PM
  4. Change as per condition font color
    By miziri in forum Programming
    Replies: 1
    Last Post: 08-20-2009, 04:23 AM
  5. Color/font change in subform
    By AndyKim in forum Forms
    Replies: 9
    Last Post: 06-24-2009, 04:34 PM

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