Color Support in Access 2007

This is the next installment in a series of posts about Access 2007 originally made by one of our developers on the Access team on his own blog that I'm moving here for the broader audience to enjoy. 

"I find color schemes that I just like and that just feel right" - Alan Bean

Access 2007 Color Picker
Figure 1: Access 2007 Color Picker

In Access 2007, we have changed the color picker control from that old 80s looking control to a 21st century color picker. This new color picker is now consistent across all of Access, and is the same one that you will see everywhere in Office 2007. As a small note, this color picker has meaningful tooltips (not color numbers, but say 'Dark Green'), which makes accessible users out there very happy.

And yes, this means that you can now (finally!) use more than 16 colors in your datasheets. You can pick any colors you want for gridlines, background and alternate background (new 2007 feature).

You can see the new color picker in Figure 1.

You probably noticed the 'Access Theme Colors' section.  Office 2007 has three themes: Silver, Blue, and Black. Access developers can develop solutions that look good in all themes by using the new set of Access Theme Colors. Alongside the colors available in Access 2003 (including the system colors, we'll talk about that in a minute), we have made available a group of colors that will change depending on which theme you are. We have 20 colors in the theme set.

The first 10 colors are colors that we use everywhere: border, background, alternate row background, selection, font color, etc. This set allows you to theme your forms and reports to match what we actually use in datasheets and everywhere in the product - so you will look as if it's an out-of-the-box Microsoft Access solution.

The second set of 10 colors is a gradient from light to dark. This set allows you to theme using variation on the same tone ("ton sur ton" like my mother likes to say). This is very effective in producing stylish, polished and professional looking reports and forms.

 

Given Access's supports of Windows System colors, this begs the question as to when developers should just use those vs. these Access theme colors. The answer is that when you'll want to chose whether your app themes with the Windows or the Office theme (e.g. your user has Green for Windows while Office is in blue). In Access 2007 I don't recommend using system colors because then your forms and reports will not be the same color as the ribbon, the task panes, the nav pane, the status bar, and the other Office UI.  That said, they still work as well as they did in Access 2003 if you reaaaaaally want to use them.

An additional benefit that I haven't mentioned yet is that all of these Access Theme colors have accessibility support in them. If any of your customers uses high contrast, these colors will adapt to it and always show correctly. So not only are you able to build solutions that look good in the Office Themes, but ones that look correctly for all your customers that require accessibility support (government contracts anyone?).

System and HTML color support
Figure 2: HTML Style RGB and System Colors

As an added bonus, we are also changing the property sheet to make all of this more helpful. First, the color properties (border color, font color, background color, etc) are now combo boxes instead of text boxes. So when you actually select one of the Access Theme Colors in the color picker, we will show "Background (white)" or something like that instead of a bogus long number. Even further, we also list all the system colors in this combo box - so you will never ever need to use that unintuitive negative number format to get system colors in the property sheet (side note: as not to break your solutions out there, the OM is unchanged).

As the last coupe-de-gra - and I think this is awesome even although most people just shrug when they hear this - the colors are now shown as HTML colors. That means that all custom colors in the property sheet will be shown as "#FF0000" instead of 255. To make it extra-nice, we allow you to type in HTML colors and old Access numeric values (you can use this as an old timer trick to impress new Access 2007 users). No more conversion tables to find the colors you like. 

You can see the new system color support and HTML style RGB colors in Figure 2.

 

Office Blogs Comments

Comments: (4) Collapse

  • Please teach the SQL Server Reporting Services team how to implement THEMES. This is a very nice feature in Access, and many other products, and it lack of presence in SSRS is inexusable.

    Thanks

  • Are you guys ever going to correct the problem where the MSysDB table just magically disappears and causes us to loose all of our work. After looking at this problem on the net, People have been reporting it since access 2.0 days. I personally, havn't run into the issues until Access 2007, and I have had to rebuild my application to fix things 5 times in the last month due to magically, the mSysDB table just disappearing?

  • On the front of the Access Colors. One thing you don't allow is setting via VBA the Colors using HTML codes. For instance. The following does not work: me.field.backcolor = "#FFFFFF" This will generate a runtime error. So you have to programatically convert the Hex to Dec. Then use the RGB Function to convert the Decimal to the appropriate number. Would be nice if you guys fixed this, since obviously you want to head to the HEX color tables, I would think the program code should support the Hex Codes as well.

  • David, You can use Hex values to assign numeric values as long as you use the VB/VBA hex prefix: &H. VBA does not understand the '#' prefix used in HTML. In this case, you could write: Me.Field.BackColor = &HFFFFFF This actually presents another issue though. In HTML, #FF0000 is Red, but using this value as a Long (&HFF0000) would give you Blue. You would need to swap the red and blue values in the HTML color to convert it to a Long Integer for use in VBA. Rob

Comments

Comments: (loading) Collapse