Results 1 to 3 of 3
  1. #1
    baba is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Nov 2011
    Posts
    43

    Report Background Color using VBA

    Could you please tell me how to change background color of MSAccess Reports using VBA?
    How can I do border coloring. What are the vba codes for all color options like light green, light blue etc.


    How to change the font type to bold etc using vba
    I did some changes to text box coloring in Detail Section on format click event.
    Thanks for the help !

  2. #2
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,862
    Quote Originally Posted by baba View Post
    Could you please tell me how to change background color of MSAccess Reports using VBA?...
    Are you trying to use VBA to assign a specific color? You can enter RGB values and Pantone values into the Properties of controls via the Property Sheet while in design view. Once they are in the properties, you can use debug.print to understand what VBA calls a specific color. Then you can create your own enum with the results.

    If you know the RGB, you could just use the RGB function. In this example RGB(5, 255, 9) = 655109

    Code:
    Me.cmdColorMe.ForeColor = RGB(5, 255, 9)
    Debug.Print Me.cmdColorMe.ForeColor '655109

  3. #3
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    Lots of color charts and converters on web http://rapidtables.com/web/color/RGB_Color.htm

    VBA has 8 intrinsic color constants: vbBlack, vbWhite, vbRed, vbGreen, vbBlue, vbYellow, vbMagenta, vbCyan

    http://excel.tips.net/T002778_Offici...es_in_VBA.html
    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. Conditional background color
    By aaslezak in forum Reports
    Replies: 5
    Last Post: 05-11-2015, 03:09 PM
  2. Setting background color of combo box
    By Access_Novice in forum Forms
    Replies: 14
    Last Post: 01-07-2015, 08:19 AM
  3. condition background color of report body
    By focosi in forum Reports
    Replies: 2
    Last Post: 09-24-2011, 11:12 AM
  4. Background Color
    By Meccer in forum Access
    Replies: 4
    Last Post: 05-30-2011, 06:49 AM
  5. background color in a form
    By taggart in forum Forms
    Replies: 1
    Last Post: 05-07-2009, 10:37 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