Solved

Access 2010 VBA: Looked all over but can't find straight answer for how to set color property of field using, #NNNNNN format

Posted on 2012-03-13
3
625 Views
Last Modified: 2012-03-14
Background:

I have this VBA statement

Form_Storage_Automation_Main_Form.HBA1.BackColor = "#F8F8F8"

I'm getting a "Type Mismatch" error.

I've looked through many online blogs and forums without success. The approach above I got out of a VB example. Is there a difference in VBA?

I don't understand what even the type would be?

What would be the correct way to do this?
0
Comment
Question by:stuckp1
3 Comments
 
LVL 70

Expert Comment

by:KCTS
ID: 37717412
get rid of the quotes
0
 
LVL 12

Accepted Solution

by:
danishani earned 250 total points
ID: 37717564
Form_Storage_Automation_Main_Form.HBA1.BackColor = &HF8F8F8

You can also use a HexColor Function as well, you can find in below thread:
http://blogs.office.com/b/microsoft-access/archive/2009/10/26/convert-hexadecimal-color-codes-so-you-can-use-them-in-code.aspx


Hope this helps,
Daniel
0
 

Author Closing Comment

by:stuckp1
ID: 37721722
The removal of quotes didn't work for me, but Daniel's example did work.
What also works is to use MSAccess
Form_Storage_Automation_Main_Form.Snapshot_Quantity.BackColor = 11908533

See http://www.endprod.com/colors/

Again, thanks to everyone.
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

This article will show you how to use shortcut menus in the Access run-time environment.
In this article we discuss how to recover the missing Outlook 2011 for Mac data like Emails and Contacts manually.
The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …
Learn how to make your own table of contents in Microsoft Word using paragraph styles and the automatic table of contents tool. We'll be using the paragraph styles in Word’s Home toolbar to help you create a table of contents. Type out your initial …

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now