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
628 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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article will show you how to use shortcut menus in the Access run-time environment.
Technology opened people to different means of presenting information, but PowerPoint remains to be above competition. Know why PPT still works today.
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…
The viewer will learn how to  create a slide that will launch other presentations in Microsoft PowerPoint. In the finished slide, each item launches a new PowerPoint presentation and when each is finished it automatically comes back to this slide: …

791 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